Node.js thinks it's February 4th

For some reason, Node.js thinks it’s February 4. Am I missing something?

> new Date().getMonth()
2
> new Date().getDay()
4
> 

Does JS start counting at 0? If so, then it knows it’s March. As for the 4… it’s neither March 4th nor March 5th.

2 Likes

4 = Thursday (0 = Sunday), 2 = March. Always read the MDN!

7 Likes

Thanks for helping, I’ll normalize it later

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.