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 Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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.