javascript Date().getYear() reports wrong year

RESOLVED DUPLICATE of bug 22964

Status

()

RESOLVED DUPLICATE of bug 22964
17 years ago
14 years ago

People

(Reporter: bsc, Assigned: rogerl)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

17 years ago
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

Comment 1

17 years ago
see comments in dup

*** This bug has been marked as a duplicate of 100123 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → DUPLICATE

Comment 2

17 years ago
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
Last Resolved: 17 years ago14 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.