Closed
Bug 294648
Opened 20 years ago
Closed 20 years ago
Javascript function getYear() (of Date) object is buggy. It returns erroneous values.
Categories
(SeaMonkey :: General, defect)
Tracking
(Not tracked)
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).
Comment 1•20 years ago
|
||
You should use getFullYear() for the expected result. *** This bug has been marked as a duplicate of 82354 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•