Closed
Bug 267028
Opened 20 years ago
Closed 20 years ago
The Date.getYear() function fails for years >2000, e.g. returns 104 instead of 2004
Categories
(Firefox :: General, defect)
Tracking
()
People
(Reporter: rick, Assigned: bugs)
References
()
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20041026 Firefox/1.0RC1 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20041026 Firefox/1.0RC1 The following JS code does not return 2004 as expected, it returns 104. var today = new Date(); todayyear = today.getYear(); A Y2k bug in a new product? :( Reproducible: Always Steps to Reproduce: Use e.g. the above code in a Javascript routine to validate a form. If it, say, requires the current year to be >2000 the form will always fail. I encountered this in a form on an ecommerce site. I was unable to submit my booking using Firefox, I had to resort to IE - ack! The form's validation logic was not wrong, but it assumed getYear() would return the year as a 4-digit number.
Comment 1•20 years ago
|
||
*** This bug has been marked as a duplicate of 22964 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Comment 2•19 years ago
|
||
--> Websites :: www.mozilla.com so timeless can close out Firefox :: Product Site.
Component: Product Site → www.mozilla.com
Product: Firefox → Websites
Comment 3•19 years ago
|
||
-> Firefox::General (939393)
Component: www.mozilla.com → General
Product: Websites → Firefox
You need to log in
before you can comment on or make changes to this bug.
Description
•