Closed
Bug 1118690
Opened 11 years ago
Closed 8 years ago
new Date(1965, 0, 1).getFullYear() returns 1964 in the UK timezone
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
People
(Reporter: jonco, Unassigned)
References
Details
(Whiteboard: [webcompat])
In the UK timezone, the following happens:
js> new Date(1965, 0, 1).getFullYear();
1964
The Date() constructor converts local time to UTC. At 1st January 1965 the UK was on GMT, so this should return 1965.
As mentioned in bug 1093130, I think this is because to determine DST for years before 1970 we map them to 'equivalent' years, and we map 1965 to 1971 which falls inside a period where the UK was on GMT+1 due to the British Standard Time experiment (see http://en.wikipedia.org/wiki/British_Summer_Time#Periods_of_deviation for details).
I think the problem is the idea of mapping to equivalent years, since these years may not be equivalent depending on your location.
Updated•9 years ago
|
Whiteboard: [webcompat]
Comment 1•8 years ago
|
||
Fixed in https://hg.mozilla.org/mozilla-central/rev/b7ef07909cc4
Before (Ubuntu - Time zone is Europe/London, current system time doesn't observe DST, e.g. set to "Jan 12 2017"):
new Date(1965, 0, 1).getFullYear()
1964
After (Ubuntu - Time zone is Europe/London, current system time doesn't observe DST, e.g. set to "Jan 12 2017"):
1965
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•