JavaScript Date Quirk

I ran into this today:

NaanCoder.png

I am sure it totally makes sense in the head of a programmer who wrote the JS interpreter, but I really find it odd. I mean look at this one:

New_Tab.png

When you pass 1 to the day, it’s the first day of the month, but when you pass 1 to the month, it’s the second month? 🤪

Author: Arunmozhi

Arunmozhi is a freelance programmer and an open-source enthusiast.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.