Reputation: 257
Can somebody explain why I have to set my date to new Date(2020, 0, 25);
Result: 'Sat Jan 25 2020 00:00:00 GMT+0100 (Central European Standard Time)'
I have another example
Variabele initialized to: new Date(2019, 10, 25);
Result: Mon Nov 25 2019 00:00:00 GMT+0100 (Central European Standard Time)
Last time I checked my calender, Month 10 is still Oktober
Upvotes: 0
Views: 71
Reputation: 431
Javascript uses zero based indexing for month, so you would have to use
new Date(2019, 9, 25)
for 25th Oct 2019
Upvotes: 2