Why is mongoDB creating wrong dates for me.
> start=new Date(2011,12,23)
"Mon Jan 23 2012 00:00:00 GMT+0000 (UTC)"
> start=new Date(2011,12,24)
"Tue Jan 24 2012 00:00:00 GMT+0000 (UTC)"
> start=new Date(2011,13,24)
"Fri Feb 24 2012 00:00:00 GMT+0000 (UTC)"
> start=new Date(2011,11,24)
"Sat Dec 24 2011 00:00:00 GMT+0000 (UTC)"
>
Mongo’s date object is the Javascript date object, and its months are 0-based (Jan = 0, Dec = 11).
and besides the point, there is no month 13 in the calendar, so in at least the 3rd case, you’re feeding an invalid date in to begin with – it’s only the JS spec is polite and tranlates that into “next year” for you that it works at all.