Closed Bug 911079 Opened 12 years ago Closed 12 years ago

Wrong Date object behavior when setFullYear() < 100

Categories

(Firefox :: Untriaged, defect)

22 Branch
x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 911081

People

(Reporter: forceuserz, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:22.0) Gecko/20100101 Firefox/22.0 (Beta/Release) Build ID: 20130627161504 Steps to reproduce: var a = new Date(); console.log("a1 = "+a.toString()); var b = new Date(a); console.log("b = "+b.toString()); a.setFullYear(69); console.log("a2 = "+a.toString()); var c = new Date(a); console.log("c = "+c.toString()); var d = new Date(); d.setTime(a.getTime()); console.log("d = "+d.toString()); a.setFullYear(70); console.log("a3 = "+a.toString()); var e = new Date(a); console.log("e = "+e.toString()); a.setFullYear(100); console.log("a4 = "+a.toString()); var h = new Date(a); console.log("h = "+h.toString()); Actual results: a1 = Fri Aug 30 2013 11:17:30 GMT+0300 (EEST) b = Fri Aug 30 2013 11:17:30 GMT+0300 (EEST) a2 = Fri Aug 30 0069 11:17:30 GMT+0300 (MSK) c = Invalid Date d = Fri Aug 30 0069 11:17:30 GMT+0300 (MSK) a3 = Sat Aug 30 0070 11:17:30 GMT+0300 (MSK) e = Sun Aug 30 1970 11:17:30 GMT+0300 (MSK) a4 = Mon Aug 30 0100 11:17:30 GMT+0300 (MSK) h = Mon Aug 30 0100 11:17:30 GMT+0300 (MSK) Expected results: a1 = Fri Aug 30 2013 11:17:30 GMT+0300 (EEST) b = Fri Aug 30 2013 11:17:30 GMT+0300 (EEST) a2 = Fri Aug 30 0069 11:17:30 GMT+0300 (EEST) c = Fri Aug 30 0069 11:17:30 GMT+0300 (EEST) d = Fri Aug 30 0069 11:17:30 GMT+0300 (EEST) a3 = Sat Aug 30 0070 11:17:30 GMT+0300 (EEST) e = Sun Aug 30 0070 11:17:30 GMT+0300 (EEST) a4 = Mon Aug 30 0100 11:17:30 GMT+0300 (EEST) h = Mon Aug 30 0100 11:17:30 GMT+0300 (EEST)
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.