Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node js creates wrong Date object

I am trying to create correct Date object

new Date("December 15, 2015")

I expect this

2015-12-15T00:00:00.000Z

But the actual outcome is this

2015-12-14T16:00:00.000Z

What is wrong?

like image 783
kurumkan Avatar asked Apr 29 '26 08:04

kurumkan


1 Answers

Run your node like this:

$ TZ=UTC node

and you don't have local time zone issues.

like image 74
CFrei Avatar answered Apr 30 '26 20:04

CFrei



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!