Date petpeeve

Mar 8, 2010 at 4:33 PM


This is not a bug per se, but it can be a source of confusion.


var x = new Date(2000, 0, 1); // Jan, first of 2000

Months are 0 based, but days are 1 based... it is not consistent.

Can you guys make months to be 1 based too? it will be consistent and it will read much more natural.



Mar 8, 2010 at 5:09 PM



This is how it is defined in the ECMAScript standard. Since we want to respect as much as we can, we would not change this.



Mar 8, 2010 at 5:23 PM


I couldn't believe it, but I you are absolutely right.

In the standard (, in the PDF page 165, item, first paragraph explain that months are numbered from 0 to 11. While in the same page, next point does say that days are 1 to 31.

I cannot possible imagine what were the talks that they concluded that this is the best representation.


Mar 9, 2010 at 8:04 AM


Me neither, but there must be a reason, I think they are much more clever than you or I, or at least, I hope so ;-)

Mar 9, 2010 at 1:38 PM


I don't know about cleverness... sometimes decisions like this one are made out of political advantages rather than technical ones.