Reputation: 359
Can someone please shed some light on why when I create a date object I receive the wrong month like so:
new Date("2013-11-25").getMonth()
output> 10
new Date("2013-11-25").toISOString()
output> 2013-11-25T00:00:00.000Z
I've seen this happen a couple of times and it's confusing me slightly. Is it a bug or am I missing something?
Upvotes: 1
Views: 1349
Reputation: 26012
It is correct. This happens because in javascript month start from 0 not 1.
You can read in details here.
Upvotes: 2