I'm having a weird situation. Recently I've moved from Azure cloud to Digital Ocean server. I'm using Nodejs version v10.15.0 and Centos 7.
My timedatectl output is
[deploy@prod-ca-api install-scripts]$ timedatectl
Local time: Tue 2019-03-19 15:34:21 IST
Universal time: Tue 2019-03-19 10:04:21 UTC
RTC time: Tue 2019-03-19 10:04:21
Time zone: Asia/Kolkata (IST, +0530)
NTP enabled: no
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
[deploy@prod-ca-api install-scripts]$
The output of date by setting the hours to start of the day is giving me proper output for the current date. But the same is responding with 24 minutes difference for dates below the year 1900.
My timezone setting is in IST (+5.30)
[deploy@prod-ca-api install-scripts]$ date
Tue Mar 19 15:36:57 IST 2019
[deploy@prod-ca-api install-scripts]$ node
> let a = new Date()
undefined
> a.setHours(0,0,0,0)
1552933800000
> a
2019-03-18T18:30:00.000Z
> a = new Date('1700-01-01')
1700-01-01T00:00:00.000Z
> a.setHours(0,0,0,0)
-8520357208000
> a
1699-12-31T18:06:32.000Z
Previously in Azure servers, I used to get 1699-12-31T18:30:00.000Z instead of 1699-12-31T18:06:32.000Z