Closed Bug 169766 Opened 22 years ago Closed 20 years ago

JavaScript reports now.getYear() (of 2002) as 102

Categories

(Core :: JavaScript Engine, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 22964

People

(Reporter: lance, Assigned: rogerl)

References

()

Details

With the following in the <HEAD> section... <csimport user="../../ProfJoe.data/Components/BottomNav.html" occur="21"> <SCRIPT LANGUAGE="JavaScript1.2" TYPE="TEXT/JAVASCRIPT"> <!-- Hide script from old browsers dayName = new Array ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday") monName = new Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December") now = new Date // End hiding script from old browsers --> </SCRIPT> ...and the following in the <BODY> section <script language="JavaScript1.2" type="TEXT/JAVASCRIPT"> <!-- // Hide script from old browsers document.write("<font size='-2' color='#696969' face='Arial,Helvetica,Geneva,Swiss'>" + dayName[now.getDay()] + ", " + monName[now.getMonth()] + " " + now.getDate() + ", " + now.getYear() + "</font>") // End hiding script from old browsers --> </script> THE OUTPUT IN THE PAGE SHOWS THE YEAR AS '102' THIS IS NOT THE BEHAVIOR OF I.E. OR OMINWEB
Rhino is a standalone language engine. Any JS bugs that occur within the browser should be filed against: JavaScript Engine (if the bug does not involve any DOM functionality) DOM Level 0 (otherwise) Reassigning to JavaScript Engine, although this bug happens to be invalid. I will say more below -
Assignee: nboyd → rogerl
Component: Core → JavaScript Engine
Product: Rhino → Browser
Summary: Javascript reports now.year() (of 2002) as 102 → JavaScript reports now.getYear() (of 2002) as 102
Have to mark this one invalid; sorry. The getYear() method should not be used here. Instead, use the getFullYear() method. For references on this issue, including how Microsoft and Netscape came to differ on the behavior of getYear(), see: bug 22964 bug 45764 bug 151912 bug 155995 The ECMA-262 Edition 3 spec for the language, which also explains this, is at http://www.mozilla.org/js/language.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
Marking Verified. Thank you for using Mozilla; please file any other bugs as you find them. We depend on contributors like you to find the things we miss -
Status: RESOLVED → VERIFIED
Status: VERIFIED → REOPENED
Resolution: INVALID → ---
*** This bug has been marked as a duplicate of 45764 ***
Status: REOPENED → RESOLVED
Closed: 22 years ago20 years ago
Resolution: --- → DUPLICATE
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
*** This bug has been marked as a duplicate of 22964 ***
Status: REOPENED → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.