mde / timezone-js

DEPRECATED: Timezone-enabled JavaScript Date object. Uses Olson zoneinfo files for timezone data.
824 stars 183 forks source link

Broken in Firefox 3.6 #45

Closed tadfisher closed 12 years ago

tadfisher commented 12 years ago

Minimal test-case:

var dt = new timezoneJS.Date(2012, 9, 8, 0, 0, 0, "Pacific/Honolulu");
dt.toJSON();

>>> Error: Units must be a number.

Not sure what's causing this only in Firefox 3.6; it looks like timezone.getTzInfo isn't set at the time toString() is called. IE, newer Firefoxes, and Chrome works fine.

tadfisher commented 12 years ago

Here's something that is odd.

Running this code repeatedly has varying results:

>>> new timezoneJS.Date(1349690400000, "Pacific/Honolulu");
2012-10-08 00:00:00 { _useCache=true, _tzInfo={...}, more...}
>>> new timezoneJS.Date(1349690400000, "Pacific/Honolulu");
0NaN-NaN-NaN NaN:NaN:NaN { _useCache=true, _tzInfo={...}, more...}
>>> new timezoneJS.Date(1349690400000, "Pacific/Honolulu");
2012-10-08 00:00:00 { _useCache=true, _tzInfo={...}, more...}
>>> new timezoneJS.Date(1349690400000, "Pacific/Honolulu");
0NaN-NaN-NaN NaN:NaN:NaN { _useCache=true, _tzInfo={...}, more...}
>>> new timezoneJS.Date(1349690400000, "Pacific/Honolulu");
2012-10-08 00:00:00 { _useCache=true, _tzInfo={...}, more...}
longlho commented 12 years ago

hmm that's weird indeed. Can you specify which browser/OS? I'll take a look

tadfisher commented 12 years ago

Firefox 3.6, Windows 7 (also tested on XP, same issues)

longlho commented 12 years ago

Cool I'll try to repl and fix it

satyrad commented 12 years ago

Same problem, Firefox 3.x. Tested several versions between 3.0 and 3.5. Tested on Windows 7 and Linux. Trying to find my way around right now, but can't find it so far. Very annoying issue that unfortunately did not occur in modern browsers, therefore now the changes are live on my site and suddenly all customers with FF 3.x are complaining! ;)

longlho commented 12 years ago

Should be fixed now so guys, try it out. Sry I couldn't find time till now.

satyrad commented 12 years ago

Will try immediately. Thanks a lot!

Edit: Great, I tested it and it seems to work like a charm! Awesome and thanks a lot!