Closed Bug 294628 Opened 19 years ago Closed 19 years ago

Javascript Date object: getYear() not giving correct value

Categories

(Firefox :: General, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 22964

People

(Reporter: g_c_bennett, Unassigned)

Details

User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; T312461)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4

In the following examples, getYear is giving 105 and 104 instead of 2005 and 
2004 respectively.

<script>
function doMe(){
  var now = new Date();
  alert(now); // displays date/time string for right NOW.
  alert(now.getYear()); // displays 105

  var anotherDate = new Date("May 18, 2004");
  alert(anotherDate);
  alert(anotherDate.getYear());
}
</script>
<a onclick="doMe();">do me</a>

Reproducible: Always

Steps to Reproduce:
1. Call getYear on a Date javascript object

Actual Results:  
got the wrong year value

Expected Results:  
given me the actual year
just found that getYear is deprecated, use getFullYear instead..

sorry....
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
Status: RESOLVED → VERIFIED
Status: VERIFIED → UNCONFIRMED
Resolution: INVALID → ---

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