Closed
Bug 269424
Opened 20 years ago
Closed 16 years ago
Javascript date function with wrong result. Linux only problem
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: sbassi, Unassigned)
References
()
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0 document.write(new Date(1988,11,1,0,0,0).toString()); should return Nov 1 1998, but I get (in Linux): Wed Nov 30 1988 23:00:00 GMT-0300 (ART) In Windows works OK (it returns Thu Dec 01 1988 00:00:00 GMT-0300 (SA Eastern Standard Time). Reproducible: Always Steps to Reproduce: 1. Open a text editor and write: <HEAD> </HEAD> <BODY> <SCRIPT> document.write(new Date(1988,11,1,0,0,0).toString()); </SCRIPT> </BODY> 2. Save this as html 3. Open that page with FF 1.0 under Linux. Actual Results: Wed Nov 30 1988 23:00:00 GMT-0300 (ART) Expected Results: Thu Dec 01 1988 00:00:00 GMT-0300 (SA Eastern Standard Time)
Reporter | ||
Comment 1•20 years ago
|
||
If you put document.write(new Date(1988,11,1)) you get the same as reported (diferent dates in diferent platforms).
Comment 2•19 years ago
|
||
This Error Also ocurrs on Mozila 1.7.5 Suite and Firefox 1.0.1 Both on Linux (XOrg 6.8.1 - Krnl 2.4.29). On Windows works fine. On Netscape Browsers also works fine. Simple Script to reproduce the error: <html> <script> alert(new Date(2005,9,14)); alert(new Date(2005,9,15)); alert(new Date(2005,9,16)); </script> </html> The 09/16/2005 on 3rd alert appears like 09/15/2005. For the 2004 year works fine.
Comment 3•19 years ago
|
||
*** Bug 282357 has been marked as a duplicate of this bug. ***
Comment 4•19 years ago
|
||
Possible dupe of bug 112130?
Firefox v1.0.6 for Windows XP JavaScript var today = new Date(); var thisYear = today.getYear(); Returns 105 instead of 2005
Comment 6•19 years ago
|
||
(In reply to comment #5) > Firefox v1.0.6 for Windows XP > > JavaScript > > var today = new Date(); > var thisYear = today.getYear(); > > Returns 105 instead of 2005 TRy this to solve the Year Format Problem using thsi code instead: <script language =Javascript> var today = new Date(); var thisYear = today.getYear(); if (thisYear<1900) { thisYear=(thisYear+1900); } document.write (thisYear); </script>
Updated•19 years ago
|
Assignee: firefox → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → 1.7 Branch
Comment 7•19 years ago
|
||
The last two comments have nothing to do with this bug as reported. Don't use getYear, use getFullYear. End of story (this was settled in ECMA-262 Edition 1 before y2k; IE did something other than what that spec advises in its informative annex for getYear; we can't fix IE at this point, and we should not try following it into the weeds here). Can someone with canconfirm privs confirm this bug? /be
Comment 8•19 years ago
|
||
Can't confirm this in windows or linux FF 1.0.7 with PST. I can't change the timezeone on my test linux box so someone else with linux will have to test this. Reporter, is this still a problem in FF 1.5?
Comment 9•16 years ago
|
||
fedora 8/Maseru time zone new Date(1988,11,1,0,0,0) Thu Dec 01 1988 00:00:00 GMT+0200 (SAST) => wfm
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•