Closed
Bug 235837
Opened 21 years ago
Closed 21 years ago
Bad handling of years after 2000 in getYear() function
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
People
(Reporter: phate.007, Unassigned)
Details
User-Agent:
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040206 Firefox/0.8
Mozilla badly treats years after 2000 in getYear() function. In year 2004 it
says, that it is year 104.
I must manually add number 1900 to all years, which are represented by smaller
number than 1000.
Reproducible: Always
Steps to Reproduce:
// JavaScript Document
lastmod = new Date(document.lastModified);
lastmoddate = Date.parse(lastmod);
month = lastmod.getMonth();
month++;
seconds = lastmod.getSeconds()
minutes = lastmod.getMinutes()
hours = lastmod.getHours()
years = lastmod.getYear();
if (seconds < 10){
seconds = "0" + seconds
}
if (minutes < 10){
minutes = "0" + minutes
}
if (hours < 10){
hours = "0" + hours
}
//this if statement must I add in order to have accurate results in Mozilla
if (years < 1000){
years = years + 1900
}
lastmodif = lastmod.getDate() + "." + month + "." + years + " v " + hours + ":"
+ minutes + ":" + seconds;
if(lastmoddate == 0){
document.write("Unknown date of last modification")
} else {
document.write("Last modification: " + lastmodif)
}
Comment 1•21 years ago
|
||
getYear() was deprecated. Use getFullYear() instead of getYear().
See bug 45764 comment 4 for further info.
*** This bug has been marked as a duplicate of 45764 ***
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → DUPLICATE
Updated•21 years ago
|
Status: RESOLVED → VERIFIED
Updated•21 years ago
|
Status: VERIFIED → UNCONFIRMED
Resolution: DUPLICATE → ---
Comment 2•21 years ago
|
||
*** This bug has been marked as a duplicate of 22964 ***
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago → 21 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•