Friday, April 1, 2011

Re: GWT Date Serialization problem

The standard GWT RPC serialization for dates writes out the long value, so that should be sent correctly. The error comes because when you convert that long to a string, you do so in a particular timezone, and your choice of timezone can change the day that you think this time point occurred on.

Passing your dates as strings, or some other custom encoding will fix the problem. The other option is to change GWT by writing your own custom field serializers for java.util.Date, java.sql.Date and java.sql.Timestamp so that it sends dates with separate values for day, month and year.

See http://groups.google.com/group/google-web-toolkit/browse_thread/thread/5c397f3ffc4e24fa/a925fc77879fa6b6

Paul

On 01/04/11 12:22, Juan Pablo Gardella wrote:
But is the same time. I think gwt serialize the long value of the time and then create a date in client side with this value. Is this correct?

2011/4/1 Brendan Doherty <brendan@propertysimplified.com>
How will noon fix the problem?

Assuming your server is running on central time (UTC-6) and you pass it to a client I'm running here in New Zealand (currently UTC+13), your March 15 noon will become March 16 6am.  You'll still be a day off.
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
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.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
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