4 ms·
JavaScript timestamps are POSIX timestamps times 1000, and POSIX timestamps have to be corrected for leap seconds at the OS level, not in the application. The
by rspeer 10y ago
JavaScript timestamps are POSIX timestamps times 1000, and POSIX timestamps have to be corrected for leap seconds at the OS level, not in the application.
The advantage of this is that 1483228800000 is definitely the start of 2017 (and in general, UTC days start on multiples of 86400 seconds, or 86400000 in JS). The disadvantage is that Date(1483228799999) could happen twice, and the first time it would be followed by Date(1483228799000).
In your application, you have to be able to cope with time going backwards for a moment. (But this is already true whenever your system contacts an NTP server.)