Reputation: 859
Running the code beneath on google-chrome 45.0.2454.99 m:
var date = new Date(1500,10,11)
date.setHours(12) // Important to avoid changing the day after localization
document.write(date + "<br>");
document.write(date.toString() + "<br>");
document.write(date.toDateString() + "<br>");
document.write(date.toLocaleDateString() + "<br>");
It returns:
Sun Nov 11 1500 12:00:00 GMT-0200 // 11/11/1500
Sun Nov 11 1500 12:00:00 GMT-0200 // 11/11/1500
Sun Nov 11 1500 // 11/11/1500
01/11/1500 // -- This one differs from the others above
Can anyone explain me why and how to fix this problem?
Upvotes: 2
Views: 1274
Reputation: 859
It really was a bug, corrected in December 8th, 2015 https://chromium.googlesource.com/v8/v8.git/+/d67756a7753e322fdd986399677a45a0459a5d40
Upvotes: 1