Closed Bug 704486 Opened 14 years ago Closed 7 years ago

Javascript Date doesn't account for double summer time during WW2 correctly

Categories

(Core :: JavaScript Engine, defect)

8 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1346211
Tracking Status
firefox9 - ---
firefox10 - ---
firefox11 - ---

People

(Reporter: u430174, Unassigned)

References

Details

Attachments

(5 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0.1) Gecko/20100101 Firefox/8.0.1 Build ID: 20111122085954 Steps to reproduce: Numerous dates between 1941 and 1945 don't account for summer time. At least not in Europe/Zagreb timezone (GMT+01:00). Environment: Arch linux (also reproducible in Ubuntu 11.04) Firefox 8.0.1 (http://www.archlinux.org/packages/extra/x86_64/firefox) "uname -srm": Linux 3.1.1-1-ARCH x86_64 Timezone: Europe/Zagreb GMT+01:00 Actual results: var d = new Date(Date.UTC(1942, 5, 11, 22, 0, 0, 0)); // firebug reports "Date {Thu Jun 11 1942 23:00:00 GMT+0100 (CEST)}" // so date is reported as CEST but not accounted for d.getFullYear(); // 1942 d.getMonth(); // 5 - Jun d.getDate(); // 11 d.getHours(); // 23 d.getMinutes(); // 0 d.getSeconds(); // 0 d.getMilliseconds(); // 0 d.getTimezoneOffset(); // -60 Expected results: var d = new Date(Date.UTC(1942, 5, 11, 22, 0, 0, 0)); d.getFullYear(); // 1942 d.getMonth(); // 5 - Jun d.getDate(); // 12 d.getHours(); // 0 d.getMinutes(); // 0 d.getSeconds(); // 0 d.getMilliseconds(); // 0 d.getTimezoneOffset(); // -120 // Chrome15, IE9 and code in Java all behave as expected. // Firefox works as expected for other years (e.g. 1990)
Version: 9 Branch → 8 Branch
Here is the same thing, only easier to read: var d = new Date(Date.UTC(1942, 5, 11, 22, 0, 0, 0)); // Firefox 8.0.1, Rhino 1.7 release 3 2011 10 16 d.toString(); // Thu Jun 11 1942 23:00:00 GMT+0100 (CET) // Chrome15, IE8, nodejs 0.6.2, and code in Java and Ruby d.toString(); // Fri Jun 12 1942 00:00:00 GMT+0200 (CEST)
Wops. I was a bit hasty with my last comment. I missed a small detail. Rhino reports CET time, while Firefox reports CEST. Here is that same examples again in Firefox and in Rhino. Of course Rhino is the least of my worries. :) var d = new Date(Date.UTC(1942, 5, 11, 22, 0, 0, 0)); // Firefox 8.0.1 d.toString(); Thu Jun 11 1942 23:00:00 GMT+0100 (CEST) // Rhino 1.7 release 3 2011 10 16 d.toString(); Thu Jun 11 1942 23:00:00 GMT+0100 (CET)
That information doesn't come from Firefox - it's delivered by the operating system or the C library. I think that they all use the same information (Windows too ?), which is the "tz" timezone database. But you shouldn't compare results from different platforms, they don't always have the same version of the data. http://en.wikipedia.org/wiki/Tz_database I tried to find an online copy of the file, and I found one here : <http://www.openbsd.org/cgi-bin/cvsweb/src/share/zoneinfo/datfiles/europe?rev0=1.45;content-type=text%2Fplain>. As far as I can see (I'm not an expert here), I don't see a 1941 rule in the C-Eur section - I don't know what happened on Jun 11 1942.
I had a deja vu feeling; bug 637244 is also about DST during WW2. Not sure if it's the same problem though.
I figured that tzdata could be the culprit. If anyone finds it useful, I'm using the following version of tzdata package: http://www.archlinux.org/packages/core/x86_64/tzdata. However, if I run given test in Firefox, Rhino, Chrome and in Java _on the same computer_, I still get those time differences. One would expect that Java and Chrome both use the same tzdata as Firefox.
> One would expect that Java and Chrome both use the same tzdata as Firefox. I believe Java, at least, ships its own timezone information instead of using the system's....
I've attached output when running following snippet in Firefox 8.0.1 and Chromium 15: 8<--------------------------------------------------------- var show = function(year, days) { var days = year % 4 == 0 ? 366 : 365; for(var d = 0; d < days; d++) { var root = new Date(Date.UTC(year, 0, 1, 22, 0, 0, 0)); root.setUTCDate(root.getUTCDate() + d); console.log(root.toString()); } }; show(1941); show(1942); show(1943); show(1944); show(1945); --------------------------------------------------------->8 I got `firefox_chromium_diff.txt' by running: `diff --side-by-side --suppress-common-lines firefox_1941-1945.txt chromium_1941-1945.txt'. Hope that helps us determine a bug.
Turns out I found vague information in a link that Jo Hermans provided. Namely: 8<--------------------------------------------------------- # Serbia # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Belgrade 1:22:00 - LMT 1884 1:00 - CET 1941 Apr 18 23:00 1:00 C-Eur CE%sT 1945 1:00 - CET 1945 May 8 2:00s 1:00 1:00 CEST 1945 Sep 16 2:00s # Metod Kozelj reports that the legal date of # transition to EU rules was 1982-11-27, for all of Yugoslavia at the time. # Shanks & Pottenger don't give as much detail, so go with Kozelj. 1:00 - CET 1982 Nov 27 1:00 EU CE%sT Link Europe/Belgrade Europe/Ljubljana # Slovenia Link Europe/Belgrade Europe/Podgorica # Montenegro Link Europe/Belgrade Europe/Sarajevo # Bosnia and Herzegovina Link Europe/Belgrade Europe/Skopje # Macedonia Link Europe/Belgrade Europe/Zagreb # Croatia --------------------------------------------------------->8 Dates don't match but at least Europe/Zagreb and 1941 is there. :) If I'd only know exact tzdata that I have installed I'd look into it more closely. All I know is package version (2011n-1): http://www.archlinux.org/packages/core/x86_64/tzdata. Does anyone know command line utility that reads `/usr/share/zoneinfo/Europe/Zagreb' file? Here is file dump: $ file /usr/share/zoneinfo/Europe/Zagreb /usr/share/zoneinfo/Europe/Zagreb: timezone data, version 2, 6 gmt time flags, 6 std time flags, no leap seconds, 120 transition times, 6 abbreviation chars
It doesn't look like there is anything incredibly convenient for reading the tz files. I found a list of related stuff here: http://www.twinsun.com/tz/tz-link.htm but none of it looked like it would easily dump out a text form of the data. (Removing tracking flags because this doesn't look like a Fx bug--I tried it on my Win 7 machine and got the right answer.)
I tried the same test on Windows 7 and got different results. Output from Firefox and Chrome match. The only conclusion I can make is that Chrome (as well as Java) use different tzdata then one provided by OS. Only Firefox uses native tzdata and that data appears to be incorrect on Linux. You can close/discard this bug as it isn't in Firefox. Sorry to have wasted your time. If you don't mind I'll use this page as a reference in order to report a bug in the actual source. Apparently here: http://www.twinsun.com/tz/tz-link.htm
(In reply to disponiblekonto from comment #16) > You can close/discard this bug as it isn't in Firefox. Sorry to have wasted > your time. No problem--thanks for trying to help us--it was a good bug report. > If you don't mind I'll use this page as a reference in order to report a bug > in the actual source. Apparently here: http://www.twinsun.com/tz/tz-link.htm Sure.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → INVALID
This appears to be a bug in Firefox after all. Bug is related to Firefox not accounting for _double_ summer time during WWII. See http://thread.gmane.org/gmane.comp.time.tz/4550 thread for more information. I'll summarize discussion here. During WWII: - US suspended summer time - The British used double summer time (+ 1 hour in winter, +2 in summer) - by data that I'm getting Europe/Zagreb also used double summer time I got data that led me to such conclusion by running following command: 8<--------------------------------------------------------- $ zdump -v -c1940,1946 Europe/Zagreb Europe/Zagreb -9223372036854775808 = NULL Europe/Zagreb -9223372036854689408 = NULL Europe/Zagreb Fri Apr 18 21:59:59 1941 UTC = Fri Apr 18 22:59:59 1941 CET isdst=0 Europe/Zagreb Fri Apr 18 22:00:00 1941 UTC = Sat Apr 19 00:00:00 1941 CEST isdst=1 Europe/Zagreb Mon Nov 2 00:59:59 1942 UTC = Mon Nov 2 02:59:59 1942 CEST isdst=1 Europe/Zagreb Mon Nov 2 01:00:00 1942 UTC = Mon Nov 2 02:00:00 1942 CET isdst=0 Europe/Zagreb Mon Mar 29 00:59:59 1943 UTC = Mon Mar 29 01:59:59 1943 CET isdst=0 Europe/Zagreb Mon Mar 29 01:00:00 1943 UTC = Mon Mar 29 03:00:00 1943 CEST isdst=1 Europe/Zagreb Mon Oct 4 00:59:59 1943 UTC = Mon Oct 4 02:59:59 1943 CEST isdst=1 Europe/Zagreb Mon Oct 4 01:00:00 1943 UTC = Mon Oct 4 02:00:00 1943 CET isdst=0 Europe/Zagreb Mon Apr 3 00:59:59 1944 UTC = Mon Apr 3 01:59:59 1944 CET isdst=0 Europe/Zagreb Mon Apr 3 01:00:00 1944 UTC = Mon Apr 3 03:00:00 1944 CEST isdst=1 Europe/Zagreb Mon Oct 2 00:59:59 1944 UTC = Mon Oct 2 02:59:59 1944 CEST isdst=1 Europe/Zagreb Mon Oct 2 01:00:00 1944 UTC = Mon Oct 2 02:00:00 1944 CET isdst=0 Europe/Zagreb Tue May 8 00:59:59 1945 UTC = Tue May 8 01:59:59 1945 CET isdst=0 Europe/Zagreb Tue May 8 01:00:00 1945 UTC = Tue May 8 03:00:00 1945 CEST isdst=1 Europe/Zagreb Sun Sep 16 00:59:59 1945 UTC = Sun Sep 16 02:59:59 1945 CEST isdst=1 Europe/Zagreb Sun Sep 16 01:00:00 1945 UTC = Sun Sep 16 02:00:00 1945 CET isdst=0 Europe/Zagreb 9223372036854689407 = NULL Europe/Zagreb 9223372036854775807 = NULL --------------------------------------------------------->8 Here you can clearly see that double summer time (+2h) was in place from Apr 16 1941 until 2 Nov 1942. Further more by using command line `date' utility I got expected output. 8<--------------------------------------------------------- $ LANG=hr_HR.utf-8 TZ=Europe/Zagreb date -d '1942-11-11 22:00 UTC' +'%c %z' Wed Nov 11 23:00:00 1942 +0100 --------------------------------------------------------->8 `date' surely uses native tzdata - the same that Firefox uses. Since `date' works as expected I can only assume Firefox doesn't account for weird double summer time situation that occurred during WWII.
Thanks for looking that up! Reopening bug.
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: INVALID → ---
Summary: Javascript Date doesn't account for summer time during WW2 → Javascript Date doesn't account for double summer time during WW2 correctly
I actually meant to show example with 1942-06-11 that shows `date' command accounts for double summer time. I'm sorry for potential confusion from my previous post. 8<--------------------------------------------------------- $ LANG=hr_HR.utf-8 TZ=Europe/Zagreb date -d '1942-06-11 22:00 UTC' +'%c %z' Fri Jun 12 00:00:00 1942 +0200 --------------------------------------------------------->8
Any progress towards fixing this bug? I'd be happy to provide other information if one is needed.
I haven't had a chance to get back to this yet but I'll bump it in my list.
Assignee: general → nobody
Blocks: 285663
Dup'ing forward to bug 1346211 which should have fixed this problem. Please reopen if the issue is still present. Thanks!
Status: REOPENED → RESOLVED
Closed: 14 years ago7 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: