new Date with string past February 28th 2034 in Safari gives incorrect date

Originator:mcousins
Number:rdar://9808813 Date Originated:20-Jul-2011 02:17 PM
Status:Open Resolved:
Product:Safari Product Version:5, 5.1, 5.1.5
Classification: Reproducible:Yes
 
Summary:

When creating a new Date object using Javascript with a string past 02/28/2034 the date object returned is one day behind

Steps to Reproduce:

console.log(new Date("01/01/2034")); // Correctly returns "Sun Jan 01 2034 00:00:00 GMT-0500 (EST)"
console.log(new Date("01/01/2035")); // Incorrectly returns "Sun Dec 31 2034 00:00:00 GMT-0500 (EST)"

Narrowed down further:
console.log(new Date("02/28/2034")); // Correctly returns "Tue Feb 28 2034 00:00:00 GMT-0500 (EST)"
console.log(new Date("02/29/2034")); // Correctly returns "Wed Mar 01 2034 00:00:00 GMT-0500 (EST)" because it is not a leap year
console.log(new Date("03/01/2034")); // Incorrectly returns "Tue Feb 28 2034 00:00:00 GMT-0500 (EST)" ????

Seems that all dates are off by one from that point on:
console.log(new Date("03/01/2070")); // Incorrectly returns "Fri Feb 28 2070 00:00:00 GMT-0500 (EST)"

Expected Results:

console.log(new Date("03/01/2034")); // Should return "Wed Mar 01 2034 00:00:00 GMT-0500 (EST)" 

Actual Results:

Not that as explained above

Regression:

Notes:

This has been reproduced on Safari on both Mac and Windows

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!