JavaScript Date.toString function generates incorrect time zone from Epoch (milliseconds=0) to less-than-Offset (17999999 in America/New_York)

RESOLVED FIXED

Status

()

RESOLVED FIXED
6 years ago
a year ago

People

(Reporter: jschortz2, Unassigned)

Tracking

15 Branch
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

6 years ago
Created attachment 672315 [details]
firefox date problem.JPG

User Agent: Mozilla/5.0 (Windows NT 5.1; rv:15.0) Gecko/20100101 Firefox/15.0.1
Build ID: 20120905151427

Steps to reproduce:

Sample code:
var d1=new Date(parseInt(document.forms[0].myDate1.value,10));
alert(d1.toString());

Input is a value from 0 (the Epoch) to 17999999 (less than my UTC offset, in Eastern time zone, i.e. America/New_York)


Actual results:

When input is zero, output from alert is "Wed Dec 31 1969 19:00:00 GMT-0500 (Eastern Daylight Time).  DAYLIGHT!!!


Expected results:

Daylight savings time indication should be STANDARD.  This happens for the entire range of input from 0 to 17999999.  When input is <=(-1) or >=18000000, i.e. <Epoch or >=my UTC offset in milliseconds, the correct ("Standard") daylight indicator is displayed

Comment 1

6 years ago
Could you provide a small html testcase, please.
(Reporter)

Comment 2

6 years ago
Created attachment 672392 [details]
test case

Test case of what I used to generate the error.

Updated

6 years ago
Attachment #672392 - Attachment mime type: text/plain → text/html
Assignee: nobody → general
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
(Assignee)

Updated

4 years ago
Assignee: general → nobody
Fixed in https://hg.mozilla.org/mozilla-central/rev/b7ef07909cc4


Before (Win10):
new Date(0).toString()
"Wed Dec 31 1969 19:00:00 GMT-0500 (Eastern Daylight Time)"

After (Win10):
new Date(0).toString()
"Wed Dec 31 1969 19:00:00 GMT-0500 (Eastern Standard Time)"
Status: UNCONFIRMED → RESOLVED
Last Resolved: a year ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.