Closed Bug 114401 Opened 24 years ago Closed 21 years ago

getYear returns 101 not 01 or 2001

Categories

(Core :: JavaScript Engine, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 22964

People

(Reporter: samuel, Assigned: rogerl)

References

()

Details

From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.6) Gecko/20011120 BuildID: 2001112009 This script writes 101 to the viewed page. <script language="javascript"> <!-- Today = new Date(); document.write(Today.getYear()); //--> </script> Reproducible: Always Steps to Reproduce: 1.point your browser at www.cc-systems.com 2.Look in the lower right corner. 3. Actual Results: Copyright © 101 CC Systems AB Expected Results: Copyright © 2001 CC Systems AB or Copyright © 01 CC Systems AB
Problem is probably caused by line http://lxr.mozilla.org/seamonkey/source/js/src/jsdate.c#803 Looking at the code at http://lxr.mozilla.org/seamonkey/source/js/src/jsdate.c#774, there is a big comment saying that one should use getFullYear() instead of getYear() or specify the version of the script. Recomment reporter try out these two solutions.
Should be marked WONTFIX, I remember an URL saying this is a normal 'buggy' behaviour to respect previous implementations and scripts, and getFullYear() should now be used to prevent this. See http://developer.netscape.com/viewsource/goodman_2k.html and http://www.xs4all.nl/~ppk/js/introdate.html for example.
Some URLs that describe problem and solution. http://www.webdevelopersjournal.com/articles/javascript_limitations.html http://wipos.p.lodz.pl/zylla/opera/introdate.html Agreed: should be WONTFIX. Perhaps should get a comment somewhere in the documentation.
see comments in bug 22964, bug 45764, bug 58241, bug 65681, bug 82354 *** This bug has been marked as a duplicate of 100123 ***
Status: UNCONFIRMED → RESOLVED
Closed: 24 years ago
Resolution: --- → DUPLICATE
Verified Duplicate - thanks to all who contributed on this.
Status: RESOLVED → VERIFIED
Status: VERIFIED → UNCONFIRMED
Resolution: DUPLICATE → ---
*** This bug has been marked as a duplicate of 22964 ***
Status: UNCONFIRMED → RESOLVED
Closed: 24 years ago21 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.