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

Jochen Kemnade commented on TAP5-841:
-------------------------------------

I spent some time trying to come up with a meaningful test but didn't succeed. 
In fact, I'm quite sure that you just can't get it right. The problem is, that 
we're mixing actual values with representations. Imagine the server stands on 
Howland Island (UTC-12) and the client is on the Marshall Islands (UTC+12).
Now, there is a datefield with a java.util.Date of 
2013-01-01T00:00:00.000-1200. Which value should be set for the client? 
2013-01-01T00:00:00.000-1200 is equivalent to 2013-01-02T00:00:00.000+1200, but 
do we want to show that on the client side?
The more I think about it, the less I'm sure which behavior the DateField 
should have. If we're really just selecting a day (without a time), maybe 
DateField should just not work with a java.util.Date internally? joda-time has 
something called LocalDate [1] for this purpose, which doesn't represent an 
actual interval or instant but something like a calendar day that has different 
start and end instants depending on in which time zone you are. 
I guess, the best option that we have is to use something like LocalDate as the 
value parameter for DateField and let the application developer decide how to 
interpret the values.

[1] http://joda-time.sourceforge.net/apidocs/org/joda/time/LocalDate.html
                
> DateField selects wrong date if client is in a different timezone than the 
> server
> ---------------------------------------------------------------------------------
>
>                 Key: TAP5-841
>                 URL: https://issues.apache.org/jira/browse/TAP5-841
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.1.0.5
>            Reporter: David Rees
>            Assignee: Howard M. Lewis Ship
>         Attachments: T5.3-DateField-Patch.txt
>
>
> This affects 5.0.18 and 5.1.0.5 in my testing.
> Situation is that if the server is running in a different timezone than the 
> client, the DateField chooser will select the wrong date on the calendar.
> For example, if the server is running in "Pacific/Auckland" and the client is 
> running in "America/Los_Angeles", Auckland is a "day ahead" of Los Angeles 
> for most of the time and the bug is easy to reproduce.
> Right now it is 3:40PM Sep 8, 2009 America/Los_Angeles and 10:40AM Sep 9, 
> 2009 Pacific/Auckland.  If the date on the server to be displayed by the 
> DateField is Sep 9, 2009, when you select the date chooser, Sep 8, 2009 is 
> selected in the JavaScript calendar dialog.
> I found this message which seems to indicate that Howard thought it might be 
> an issue - looks like he was correct:
> http://www.nabble.com/Re%3A-Tapestry-5.0.15-DateField-localization-problem--patch-included--p20033325.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to