Closed
Bug 192481
Opened 23 years ago
Closed 21 years ago
Y2K bug ! Date().getYear() reports 103 instead of 2003
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
People
(Reporter: ejb4u, Assigned: rogerl)
References
()
Details
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021130
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021130
I've just seen a page giving the age of someone using Javascript.
The age was - 1864 years.
This was a known bug in Netscape 4.x, but I thought it was fixed in Mozilla.
To see the bug, go the the Javascript console and type :
new Date().getYear()
=> it gives 103 instead of 2003.
This bug should be easy to fix.
Reproducible: Always
Steps to Reproduce:
1. Tools -> Web development -> JavaScript Console
2. Type: new Date().getYear()
3. Press Enter
Actual Results:
103 is displayed
Expected Results:
2003 should have been displayed (I'm writing this in Year 2003!)
Comment 1•23 years ago
|
||
This is as it should be, surprisingly enough.
Quoting Phil Schwartau:
"The upshot is d.getYear() was deprecated in the ECMA-262 standard
in favor of d.getFullYear()
Here are various bugs with further information on this:
bug 22964
bug 45764 <--- particuarly see last comment in this one for the history of this
bug 100123
bug 115264"
*** This bug has been marked as a duplicate of 45764 ***
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
![]() |
||
Comment 2•23 years ago
|
||
Verified "make sure you know what you're talking about"
Status: RESOLVED → VERIFIED
Reporter | ||
Comment 3•23 years ago
|
||
Thanks for the reference to
http://developer.netscape.com/viewsource/wyner_2k/wyner_2k.html
which explains a lot.
Returning more than 100 for years >2000 was considered a bug a few years ago,
and as the article explains I remenber seeing the getYear() returning "2000".
I didn't know the spec had changed back to what was considered a bug before...
My conclusion is that using getDate() is inapprorpriate, getFullYear() should
always be used.
Status: VERIFIED → CLOSED
Reporter | ||
Comment 4•23 years ago
|
||
I meant :
My conclusion is that using getYear() is inapprorpriate, getFullYear() should
always be used.
Updated•21 years ago
|
Status: CLOSED → UNCONFIRMED
Resolution: DUPLICATE → ---
Comment 5•21 years ago
|
||
*** This bug has been marked as a duplicate of 22964 ***
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago → 21 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•