I've updated Chrome to 67 version.
new Date(1924,4,1,0,0,0,0).getTime()
return -1441245724000
must -1441249200000
if millisecond(1000), second(60), minute(60) === 0 getTime must give at the end a minimum of 5 zeros
I've updated Chrome to 67 version.
new Date(1924,4,1,0,0,0,0).getTime()
return -1441245724000
must -1441249200000
if millisecond(1000), second(60), minute(60) === 0 getTime must give at the end a minimum of 5 zeros
There can be only one explanation: You are in Ukraine.
Allow me to explain:
When passing individual components to the
Date
constructor, those values are based on the local time zone of the computer where the code is running. Keeping in mind that months are zero based,new Date(1924,4,1,0,0,0,0)
is asking for1924-05-01 00:00:00.000
local time..getTime()
is asking for a Unix timestamp in milliseconds, which are based on UTC - so there is an implicit conversion from local time to UTC. Therefore, anyone who runs this code will get different results depending on their own time zone.Time zones are a relatively modern invention. They have not always existed in the way we use them today. The data that most computers keep about time zones comes from the IANA time zone database. In this data, for most time zones, the earliest entry is based on the solar local mean time (LMT) for the latitude and longitude associated with the city used to identify the time zone.
In this case, your value
-1441245724000
translates to1924-04-30 21:57:56
UTC. Since it was derived from a local time of midnight, then by math - the offset from UTC in that local time must have been+02:02:04
.The only time zone in the TZDB with an LMT value of
+02:02:04
isEurope/Kiev
, as shown here. For reasons I'm not certain of exactly, the TZDB also assigns the abbreviationKMT
(Kiev Mean Time) from 1880 to 1924.As to why you are seeing this on newer versions of Chrome - it is likely that older versions did not take the entire TZDB into consideration, but had truncated it at some point in the past. Indeed, the ECMAScript 5.1 standard used to require only the current time zone rule be applied as if it was in effect for all time. This was removed in ECMAScript 6, and most browsers now use the correct rule that was in effect for the timestamp provided.
TL;DR: Local time in Ukraine before 1 May 1924 was determined by the sun - not by the government. At least - that is the best known information that your computer has.