JavaScript Date Quirk

I ran into this today:


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:


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 Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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