Closed Bug 133435 Opened 22 years ago Closed 20 years ago

javascript Date().getYear() reports wrong year

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 22964

People

(Reporter: bsc, Assigned: rogerl)

Details

The following code produces the alert that the month is 3 (correct) and the year
is 102 (incorrect).  The year should be 2002, not 102.  Javascript should
probally be y2k compliant in y2k2?

<- cut --------

d = new Date();
Month = d.getMonth()+1;
Year = d.getYear();
alert("Month: " + Month + " Year: " + Year);

<- cut --------

Brian
see comments in dup

*** This bug has been marked as a duplicate of 100123 ***
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
Marking Verified. 

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
Status: RESOLVED → VERIFIED
Status: VERIFIED → UNCONFIRMED
Resolution: DUPLICATE → ---

*** This bug has been marked as a duplicate of 22964 ***
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago20 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.