Closed Bug 294648 Opened 19 years ago Closed 19 years ago

Javascript function getYear() (of Date) object is buggy. It returns erroneous values.

Categories

(SeaMonkey :: General, defect)

x86
Windows 2000
defect
Not set
critical

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 82354

People

(Reporter: dimitri, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; it-IT; rv:1.7.8) Gecko/20050511
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; it-IT; rv:1.7.8) Gecko/20050511

In javascript, you can get the date of the client, using the Date object. A
method of this object is getYear(). Under mozilla-1.7.8, in 2005, for example,
it returns '105' value.

Reproducible: Always

Steps to Reproduce:
Using this HTML code.
-----------------------------

<html>
<body>
<script language="JavaScript" type="text/javascript">
<!--
	function showDate() {
		var curdate=new Date();
		alert(curdate.getYear());
	}

//-->
</script>
<input type=button value='click me' onClick='showDate();'>

</body>
Actual Results:  
Clicking on button, it appears '105' value.

Expected Results:  
The correct value (2005).

The javascript console is blank (ie it doesn't launch any error or exception).
You should use getFullYear() for the expected result.

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