Intrepid Blog

Javascript’s stupid Date constructor

new Date(2009, 1, 1) represents the first of February 2009. Not the second of February nor the first of January. Why this stupidity?

2 comments

Preserved from the WordPress version of this blog. Commenting is closed.

zproxy

Do read the documentation. Month is a zero based index.

Bas Westerbaan

If you document stupidity, it’s still stupidity.