[ 
https://issues.apache.org/jira/browse/WICKET-5501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13910311#comment-13910311
 ] 

Martin Grigorov commented on WICKET-5501:
-----------------------------------------

Wicket's Date related converters are in wicket-util.
To read the client's time zone you need access to the Session and 
(Web)ClientInfo classes. And those are in wicket-core...

So, to be able to support client time zone you need to extend any of Wicket's 
Date related converters and override 
org.apache.wicket.util.convert.converter.AbstractDateConverter#getDateFormat() :

@Override
public DateFormat getDateFormat(Locale locale)
{
  DateFormat df = super.getDateFormat(locale);
  if (df != null && isApplyTimeZoneDifference()) 
  {
     df.setTimeZone(getTimeZone());
  }
  return df;
}


I understand that this is not very convenient - you need to do the same for 
j.u.Date, j.sql.Date, j.s.Time and j.s.Timestamp ...
The only way I see is to move these classes in wicket-core module.

What other devs think ?

> Support of client timezones for java.util.Date, java.util.Timestamp and etc.
> ----------------------------------------------------------------------------
>
>                 Key: WICKET-5501
>                 URL: https://issues.apache.org/jira/browse/WICKET-5501
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket, wicket-datetime
>    Affects Versions: 6.13.0
>            Reporter: Ilia Naryzhny
>              Labels: converter, time_zone, wicket
>         Attachments: AbstractDateConverter.java
>
>
> That was surprise for me that wicket doesn't support convertion of 
> java.util.Date, java.sql.Date, java.sql.Time, java.sql.Timestamp taking into 
> account client timezone.
> I know about existing DateConverter/StyleDateConverter and etc. But it's not 
> so easy to extend and reuse that for java.sql.* types.
> Please find in the attachment our implementation of date convertor which is 
> taking into account client timezone and (!) don't use org.joda.time. Hope 
> that it can be included (maybe after some refactoring) into main branch. 
> Please let me know your vision of this approach and if you are OK: let me go 
> ahead and prepare patch. 



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to