Reputation: 55792
My eyes must be deceiving me, but when I call setMonth(1)
shouldn't the date of that date object be February? (Today is March 30, 2016)
x = new Date();
y = new Date();
x.setMonth(1);
document.write(x.toString() + '<br>' + y.toString());
Results in:
Upvotes: 5
Views: 127
Reputation: 146350
There is no February 30, 2016
So therefore the date processor correctly changes the date to March 1, 2016
Upvotes: 10