Closed
Bug 278699
Opened 20 years ago
Closed 20 years ago
javascript returns incorrect date
Categories
(Firefox :: General, defect)
Tracking
()
People
(Reporter: roger, Assigned: bugzilla)
References
()
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.7.5) Gecko/20041110 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.7.5) Gecko/20041110 Firefox/1.0
The following script returns the year as 105 in Firefox and the correct 2005 in IE:
<script language="JavaScript">
// display date the page was last modified in English style - Roger Biddle
17/02/2003
parseit = Date.parse(document.lastModified)
var mydate = new Date()
mydate.setTime(parseit)
var day = mydate.getDate()
var month = mydate.getMonth() +1
var year = mydate.getYear()
document.write("<small>Last modified on: " + day +"/" + month +"/" + year
+"</small>")
</script>
Reproducible: Always
Steps to Reproduce:
1. Visit www.provender.net with Firefox or IE
2.
3.
Actual Results:
Script result is displayed at bottom right hand corner of web page:
"Last modified on dd/mm/yy"
Expected Results:
correct year should be displayed
Comment 1•20 years ago
|
||
getFullYear( ) Dup of Bug 22964 'JavaScript: getYear returns "100" for 2000'
Summary: javascript returns incorrect date → javascript returns incorrect date
Comment 2•20 years ago
|
||
firefox should return 05 instead of 105. i think thats what the bug is. and ive repoduced this bug too.
Comment 3•20 years ago
|
||
if getYear() is deprecated, and firefox is standards compliant, why do they still support?
Comment 4•20 years ago
|
||
re comment #2 - no it shouldn't. getYear is defined in ECMA-262 as years since 1900, not 'last 2 digits of year'. re comment #3 - just because it is old and flawed, doesn't mean it isn't part of the standard. *** This bug has been marked as a duplicate of 22964 *** *** This bug has been marked as a duplicate of 22964 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Comment 5•20 years ago
|
||
on bug 22964, the guy says the getYear() was deprecated. that means its no longer part of javascript. so firefox shouldnt support it at all.
| Reporter | ||
Comment 6•20 years ago
|
||
ok guys, research shows that getFullDate should be used and not getDate and getFullDate returns the correct year in Firefox.
Updated•20 years ago
|
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•