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

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

* common parent - 
org.apache.wicket.util.convert.converter.AbstractDateConverter. Check!
* getDateFormat - 
org.apache.wicket.util.convert.converter.AbstractDateConverter#getDateFormat. 
Check!
* no dependency to JodaTime. Check!

Only #getTimeZone() is missing.
Adding one that returns the the system's default is easy. You will be able to 
override it in your classes and return the client timezone or a predefined one.
Is that good enough ?

You can do this even now:
@Override public DateFormat getDateFormat(Locale locale) {
  DateFormat df = super.getDateFormat(locale);
  if (df != null) df.setTimeZone(tz);
  return df;
}

But if we add #getTimeZone() then maybe we should also add #isLenient() and 
#getNumberFormat() ... And it becomes messy. It is much cleaner to set those 
when needed as I showed above.

> 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