PDA

View Full Version : IE ignores timezone in parseDate



kai5263499
4 Jun 2009, 4:05 PM
I'm working on an app that needs all times to be in a certain timezone (EST) regardless of the user's timezone (because of legacy code on the server). I tried adding a 'T' and cooresponding 'EDT' to the Date.parseDate method I'm using to retrieve a date object which works in FF but not in IE6 (or 7) and I wondered if anyone else had run across this issue and/or knew of a solution.

I've also tried 'O' using '-0400' but that didn't work either. It's almost as if IE completely ignores any timezone data and overrides with the system timezone.

Any help will be much appreciated.

-Wes

mystix
5 Jun 2009, 4:20 AM
post your code.

kai5263499
5 Jun 2009, 4:48 AM
Date.parseDate('04/19/2010 5:00 PM EST', 'm/d/Y g:i A T');

If you run this from a FF browser in a different timezone (I've been simply changing the system time), it correctly converts the date to EST. However IE (6 and 7) override it with the local timezone.

We are also using 2.2.0 and I haven't checked whether this is one of the issues fixed in 2.2.1.

mystix
5 Jun 2009, 5:13 AM
by "timezone", are you referring to the 3/4 letter code (e.g EST), or are you referring to the timezone offset (e.g. -0400).

you could, if you wanted, simply drop the 2.2.1 Date.js in in place of 2.2.0's -- just to test of course.

kai5263499
5 Jun 2009, 5:15 AM
I'm referring to the 3/4 letter code 'EST'. What I expected (and what happens in FF and Chrome) is for the date to be converted into the desired timezone regardless of the timezone the user's browser is in.

mystix
5 Jun 2009, 5:21 AM
that's actually out of anyone's control -- all browsers impose their own timezone settings on the js engine. in other words, all js Date objects will always inherit, and be expressed in terms of, the browser's timezone settings -- there's simply no way about this.

all browsers also display different timezone strings -- see my comments in the Date.js source.

[edit]
if the timezone offset is off though then it would be a bug.
fyi, the 3/4 letter timezone delimiter plays absolutely no part in determining the timezone offset.
Date.parseDate() simply ignores that.

kai5263499
5 Jun 2009, 5:30 AM
I've tried using the 'O' format with '-0400' for EST but got the same result. Is there any way (outside of manually adjusting for the desired timezone) to force the browser to parse into a foreign timezone?

mystix
5 Jun 2009, 5:36 AM
like i mentioned above, there is absolutely no way to change the browser's timezone through the js engine.

to be certain we're both on the same page though (cos i think either of us might be misinterpreting parts of our conversation), could you post your example code, along with the actual and expected outputs from IE6/7/8 / Chrome / Firefox?