Closed Bug 629465 Opened 14 years ago Closed 7 years ago

Javascript Date object timezone uses Standard Time Zone abbreviations during Daylight Savings Time

Categories

(Core :: JavaScript Engine, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: joe, Unassigned)

References

Details

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13

When daylight savings time is in effect, the correct abbreviation for time in UTC-800 is "PDT" (Pacific Daylight Time), but Javascript is reporting "PST" (Pacific Standard Time). 

Reproducible: Always

Steps to Reproduce:
<script>
var d1 = new Date( 2011, 2, 13, 1, 0, 0, 0 );	// March 13, 2011  1 AM local Standard Time

// increment the time in one minute intervals for the next three hours
for ( var i = 0; i < 3*60; i++ )
{
	d2 = new Date( d1 );
	d2.setMinutes( d1.getMinutes() + i );
	document.write( d2 + "<br \>"  );
}
</script>

Actual Results:  
Sun Mar 13 2011 01:57:00 GMT-0800 (PST)
Sun Mar 13 2011 01:58:00 GMT-0800 (PST)
Sun Mar 13 2011 01:59:00 GMT-0800 (PST)
Sun Mar 13 2011 03:00:00 GMT-0700 (PST)
Sun Mar 13 2011 03:01:00 GMT-0700 (PST)
Sun Mar 13 2011 03:02:00 GMT-0700 (PST)



Expected Results:  
Sun Mar 13 2011 01:57:00 GMT-0800 (PST)
Sun Mar 13 2011 01:58:00 GMT-0800 (PST)
Sun Mar 13 2011 01:59:00 GMT-0800 (PST)
Sun Mar 13 2011 03:00:00 GMT-0700 (PDT)
Sun Mar 13 2011 03:01:00 GMT-0700 (PDT)
Sun Mar 13 2011 03:02:00 GMT-0700 (PDT)


Camino, Chrome, and Safari produce the expected result.
Assignee: nobody → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general
Hmm.  I get EDT for all the timezones.  Is the timezone cache biting us here?
Assignee: general → nobody
Also ran into this bug on OSX El Capitan:

new Date(1446361200000).toString();

Output: 
// Sun Nov 01 2015 01:00:00 GMT-0600 (MST)

Expected output:
// Sun Nov 01 2015 01:00:00 GMT-0700 (MDT)
This got reported to me on IRC.

I verified, on currently Nightly:

new Date().toString() gives Tue Apr 04 2017 17:33:36 GMT+0200 (CEST) on Linux
new Date().toString() gives Tue Apr 04 2017 17:33:36 GMT+0200 (Romance Standard Time) on Windows

the latter is wrong. Other browsers correctly report it as: Tue Apr 04 2017 17:33:36 GMT+0200 (Romance Daylight Time)

We are failing to recognize daylight saving time on Windows.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Mac OS X → All
Version: unspecified → Trunk
Looks like bug 554338 fixed a similar problem on Linux/macOS.
Repro'd with the jsshell SM host on Windows:

```
> eshost -is -h d8,ch-master,sm,node,node-ch -e "new Date().toString()"

## Source
print(new Date().toString())

#### d8, ch-master, node-ch, node
Mon May 08 2017 15:54:45 GMT-0700 (Pacific Daylight Time)

#### sm
Mon May 08 2017 15:54:45 GMT-0700 (Pacific Standard Time)
```
Fixed in https://hg.mozilla.org/mozilla-central/rev/b7ef07909cc4

Before (Ubuntu):
new Date(2011, 3-1, 13, 1, 0, 0).toString()
"Sun Mar 13 2011 01:00:00 GMT-0800 (PDT)"

After (Ubuntu):
new Date(2011, 3-1, 13, 1, 0, 0).toString()
"Sun Mar 13 2011 01:00:00 GMT-0800 (PST)"


Before (Ubuntu):
new Date(1446361200000).toString();
"Sun Nov 01 2015 01:00:00 GMT-0600 (MST)"

After (Ubuntu):
new Date(1446361200000).toString();
"Sun Nov 01 2015 01:00:00 GMT-0600 (MDT)"


Before (Win10):
new Date().toString()
"Thu Oct 12 2017 11:32:15 GMT+0200 (Romance Standard Time)"

After (Win10):
new Date().toString()
"Thu Oct 12 2017 11:32:11 GMT+0200 (Romance Daylight Time)"


Before (Win10):
new Date().toString()
"Thu Oct 12 2017 02:33:27 GMT-0700 (Pacific Standard Time)"

After (Win10):
new Date().toString()
"Thu Oct 12 2017 02:33:24 GMT-0700 (Pacific Daylight Time)"
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.