Friday, November 1, 2013

Re: gwt date B U G


Yesturday, Oct 31th, 2013, I had a bug with "gwt date" (I do not understand if the java.util.date has something to do with GWT but well...).

I have an 'event application', and when I was using the gwt datepicker to go the the 2nd NOV, 2013, my application has also to calculate the date of the following day.
In this example, the "tomorrow" date was indicating 3rd DEC 2013 instead of 3rd NOV 2013... (so the issue is that the date is giving me one month more).

This error was in production mode. Then I try to debug it in local mode. And I can observe something strange:
 - with SUPER DEV MODE: I have the same error than in production.
 - withOUT SUPER DEV MODE (normal debug): I can see that the "tomorrow" date is OK (cf. 3rd NOV 2013)

Thats not such a surprise. SuperDevMode works entirely inside the browser while DevMode works in a JVM. While in SuperDevMode you get JavaScript behavior and while in DevMode you get ordinary Java behavior.

Is Oct 31th or Nov 2nd a special date in your timezone? Is it maybe a day on which Daylight Saving Time (DST) is switched? 

GWT uses the following emulated Date class during GWT compilation and thus in production mode:

https://gwt.googlesource.com/gwt/+/master/user/super/com/google/gwt/emul/java/util/Date.java

At the very bottom there is a method to fix daylight saving times and maybe this method has done something wrong in your case (or your own calculation has a bug, or both). If you can still reproduce the issue (maybe put your computer time back to Oct 31) then I would debug it using SuperDevMode in Chrome and without source maps so you can see the actual JavaScript.

If you can write a mini app with your described behavior then please file a bug and attach the app along with a description how to reproduce the bug.


 
So where this bug comes from ? Is it my fault or not ? I think that GWT can do great thing, but for example, or sometime, it is bad in doing simple things...Which serious EVENT / CALENDAR application could we develop without a COOL and BUGGYLESS way of maniplating dates in the client side ? Moreover, the GWT datepicker widget has bugs that have not been corrected for 3 years...I have to do some ugly hack for this. Frustating answers are talking about using JODA or Calendar, but it does not work in the client side, and in my country the internet connexion is very slow, I do not want to do an RPC just to do some date calculations each time I need it. 

With GWT 3.0 and Java 8 support its very likely that JSR 310 aka. java.time.* will be emulated by GWT sooner or later. But even with such an emulation it may cause issues if the emulation uses JavaScript date internally because browsers behave differently and IMHO its difficult to figure out how exactly they differ from each other.

 

Now, which garantee I have that the bug that happened yesturday will not happen another day ? 

Currently, none :(


-- 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/groups/opt_out.

No comments:

Post a Comment