Tuesday, July 3, 2012

Re: Date Serialization



On Wednesday, July 4, 2012 12:43:30 AM UTC+2, Jim Douglas wrote:
Yup, probably the timezone offset.  We tripped over that too (wrong
dates when the server and client were in different time zones); we
stopped serializing Date objects and switched to sending a customized
y/m/d value instead.

Aka "using the right tool for the job".
java.util.Date represents a "specific moment in time" (as an offset from Epoch, and the Y/M/D/H/M/S are computed from there depending on the TZ); if you want a DMY independent from the TZ, then java.util.Date is not "the right tool for the job". You could use JodaTime's or ThreeTen's LocalDate for instance (they unfortunately don't play well with GWT: existing ports have not been maintained for *years*).

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/9yZ2hN9L8QoJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment