Closed
Bug 228929
Opened 21 years ago
Closed 20 years ago
JavaScript getYear() function returns 103 instead of 2003
Categories
(Firefox :: General, defect)
Tracking
()
People
(Reporter: ecleckler, Assigned: bugzilla)
References
()
Details
User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.6b) Gecko/20031216 Firebird/0.7+ Build Identifier: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.6b) Gecko/20031216 Firebird/0.7+ When coding in JavaScript, the Date() function works properly, but if you use getYear(), you get incorrect results. For example, if you have var date = new Date(); var year = date.getYear(); document.write("The current date is: " + date + "."); document.write("The current year is: " + year + "."); in your code, the results would be The current date is: Fri Dec 19 2003 00:35:41 GMT-0600 (Central Standard Time).The current year is: 103. instead of The current date is: Fri Dec 19 2003 00:35:41 GMT-0600 (Central Standard Time).The current year is: 2003. Reproducible: Always Steps to Reproduce: 1.Open Firebird 2.Go to http://prism.troyst.edu/~bcre8iv/bug.html (a small page I prepared to show the error). Actual Results: The following was displayed The current date is: Fri Dec 19 2003 00:35:41 GMT-0600 (Central Standard Time).The current year is: 103. Note that the year is not 103 Expected Results: The following should have been displayed: The current date is: Fri Dec 19 2003 00:35:41 GMT-0600 (Central Standard Time).The current year is: 2003. Note the correct year, 2003. it works properly in IE.
Reporter | ||
Comment 1•21 years ago
|
||
Forgot to say, the OS is Win ME, which isn't an option...
Comment 2•21 years ago
|
||
According to http://developer.netscape.com/docs/manuals/js/core/jsref/date.htm#1194138 , getYear() is returning the correct value. You have to use getFullYear() for the desired value.
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
Updated•20 years ago
|
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Comment 3•20 years ago
|
||
*** This bug has been marked as a duplicate of 45764 ***
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago → 20 years ago
Resolution: --- → DUPLICATE
Updated•20 years ago
|
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---
Comment 4•20 years ago
|
||
*** This bug has been marked as a duplicate of 22964 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago → 20 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•