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

RESOLVED DUPLICATE of bug 22964

Status

()

Core
JavaScript Engine
RESOLVED DUPLICATE of bug 22964
15 years ago
13 years ago

People

(Reporter: Lance Drake, Assigned: rogerl (gone))

Tracking

Trunk
PowerPC
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

15 years ago
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

Comment 1

15 years ago
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

Comment 2

15 years ago
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
Last Resolved: 15 years ago
Resolution: --- → INVALID

Comment 3

15 years ago
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
Last Resolved: 15 years ago13 years ago
Resolution: --- → DUPLICATE
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---

*** This bug has been marked as a duplicate of 22964 ***
Status: REOPENED → RESOLVED
Last Resolved: 13 years ago13 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.