Thursday, July 17, 2014

Re: DateBox incorrect time past certain dates

The next question becomes how do I reliably and dynamically get the correct time zone.

If I do something like this,
TimeZoneConstants t = (TimeZoneConstants) GWT.create(TimeZoneConstants.class);
TimeZone est = TimeZone.createTimeZone(t.americaNewYork());

It works, but I have to know what time zone I am in and since my application can be used world wide, this is not an option to have a fixed time zone in this manner. Not to mention that according to TimeZoneConstants java doc, "Time zone data has only been provided for the "en" locale".

When running a quick test creating the time zone like this, 
TimeZone zone = TimeZone.createTimeZone(new Date().getTimeZoneOffset());

I have the same problem as before, it works in dev mode but not in production. It does not account for the DST origin and isn't aware of the cut off date.

Is there another way that I am not aware to dynamically get the correct timezone information?

Thanks,
Will


On Wednesday, July 16, 2014 5:12:22 PM UTC-4, Jens wrote:
You are not alone ;-) Basically daylight saving information can be different between browsers and different between browsers and JVM (like in DevMode). These differences exist because they probably all use different timezone databases (or the same database but in different versions of it). 

What you can do is:
1.) Try to use DateTimeFormat.format(pattern, timezone). To change it for the DateBox use the three arg constructor of DateBox. This fixes quite some dates but probably not all.
2.) Only use UTC dates


-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment