Closed
Bug 337856
Opened 19 years ago
Closed 19 years ago
Incorrect display of date derived from a script
Categories
(Firefox :: General, defect)
Tracking
()
People
(Reporter: r-kastigar, Unassigned)
References
()
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3
The following script is included in the above page to get the "Date Last Modified" data for display:
<center>
<script language="JavaScript"> lastModDate = new Date(document.lastModified)
lastModMonth = lastModDate.getMonth() + 1
lastModDay = lastModDate.getDate()
lastModYear = lastModDate.getYear()
document.write("<I>This Page Last Updated: " + lastModMonth + "/"
+ lastModDay + "/" + lastModYear + "</I>")</script>
<!-- END Javascript for page last update - 'touch' home.htm -->
</center>
This results in a display of today's date at "5/13/106"
The same page viewed with IE displays the date as "5/13/2006"
Reproducible: Always
Expected Results:
I think it should display "5/13/06" or "5/13/2006" instead of "5/13/106"
I'm an amateur at this. It's quite possible the script I'm using is defective and shows that I don't know what I'm doing.
Comment 1•19 years ago
|
||
Since our correct implementation of getYear (which by spec is the current year minus 1900) is fairly rare, the best thing to do is pretend getYear doesn't exist, and never use anything but getFullYear.
*** This bug has been marked as a duplicate of 22964 ***
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.
Description
•