It turns out that the problems that I am having stem from the way the
daylight savings time dates are calculated in the browser vs. java.
Here is a link with the US & Canada DST periods:
http://www.timeanddate.com/news/time/us-daylight-saving-extended.html
For instance in 2005 the daylight savings time in Vancouver BC started
on Apr 3rd. In 2010 the DST will start on Mar 14th.
Any java.util.Date object created in the browser (compiled code: java -
> javascript) that is between 14th of Mar 2005 and Apr 3rd 2005 will
have the time portion on the java side 23:00:00 because the browser
applies the next DST period to these dates. In the host mode the dates
work as expected because probably java uses time zone tables but as
soon as the code gets compiled to javascript things are not the same
in IE7.
I created a test remote service with the following method:
public void displayDate(Date date)
{
log.error("My date is " + date);
}
the Date object is a java.util.Date.
I created this client function:
private void displayDate(final Date date)
{
AsyncCallbackAdapter<Void> o = new AsyncCallbackAdapter<Void>()
{
@Override
public void executeImpl()
{
TestService.App.getInstance().displayDate(date, this);
}
};
o.execute();
}
Now the following code:
displayDate(new Date(105, 2, 13));
displayDate(new Date(105, 2, 14));
displayDate(new Date(105, 3, 3));
displayDate(new Date(105, 3, 4));
produces (on the server) in hosted mode:
My date is Sun Mar 13 00:00:00 PST 2005
My date is Mon Mar 14 00:00:00 PST 2005
My date is Sat Apr 02 00:00:00 PST 2005
My date is Sun Apr 03 00:00:00 PST 2005
and in web mode it produces:
My date is Sun Mar 13 00:00:00 PST 2005
My date is Sun Mar 13 23:00:00 PST 2005
My date is Sat Apr 02 23:00:00 PST 2005
My date is Mon Apr 04 00:00:00 PDT 2005
Note the time portion.