Closed Bug 1401696 Opened 7 years ago Closed 6 years ago

Date() gives inconsistent results between platforms

Categories

(Core :: JavaScript Engine, defect, P3)

55 Branch
defect

Tracking

()

RESOLVED DUPLICATE of bug 1346211
Tracking Status
firefox57 --- wontfix

People

(Reporter: sworddragon2, Unassigned)

References

Details

(Whiteboard: [js:correctness])

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0
Build ID: 20170919185010



Actual results:

After upgrading Firefox from version 54 to version 55.0.2 I'm noticing that an own site and the web console (if timestamps are enabled) are showing me the time with 2 hours in the past. This is the case with a Linux host but a Windows 10 guest (VirtualBox) does show the correct values. On having checked then Date()'s behavior I have noticed some discrepancies and am assuming it might be the cause of this issue. For example doing a test in the web console at 20:51 results with the following:

Linux:
> new Date(1970, 0, 1, 0, 0, 0);
< Date 1970-01-01T00:00:00.000Z
> new Date();
< Date 2017-09-20T18:51:12.500Z

Windows:
> new Date(1970, 0, 1, 0, 0, 0);
< Date 1969-12-31T23:00:00.000Z
> new Date();
< Date 2017-09-20T18:51:21.489Z


new Date(); returns always 2 hours in the past (since my timezone is CEST 2 hours in the past would be UTC) which I think is correct after looking at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date . I'm not sure what the offset should be if Date() is given an argument. On Linux no offset was applied and on Windows the time was 1 hour in the past. At least that Linux and Windows return a different result here seems to be not correct.
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
The currently used POSIX date/time APIs can return incorrect time zone information for certain past and future dates (dates before 01 January 1970 and after 19 January 2038, UTC). This can be an issue in `new Date(1970, 0, 1, 0, 0, 0)` for time zones east of UTC. Plus Windows may not use the correct time zone rules for certain past dates in general (bug 1330307, comment #1).

bug 1346211 should help to compute more correct and more consistent time zone information across different platforms.
Priority: -- → P3
Whiteboard: [js:correctness]
Blocks: 285663
Dup'ing forward to bug 1346211 which should have fixed this problem. Please reopen if the issue is still present. Thanks!
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.