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)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 22964

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) }
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
Status: RESOLVED → VERIFIED
Status: VERIFIED → UNCONFIRMED
Resolution: DUPLICATE → ---
*** This bug has been marked as a duplicate of 22964 ***
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago21 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.