Closed Bug 1143398 Opened 9 years ago Closed 6 years ago

OSX Javascript new Date() initialized with Standard Timezone instead of Daylight Savings for Adelaide / ACDT

Categories

(Core :: JavaScript Engine, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1346211

People

(Reporter: jberzins, Unassigned)

References

Details

Attachments

(1 file)

Attached image TestDate-Firefox.png
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36

Steps to reproduce:

Environment
- Macbook Pro retina, 15-inch
- OS X Yosemite: 10.10.2
- Firefox: 35.0.1
- Timezone: Adelaide - Australia
Issue in OS X only, on Windows date calculation works correctly.

Code example:
<html>
<p id="date1"/>
<p id="date2"/>
<script>
var startDate = new Date(621000); 
document.getElementById("date1").innerHTML = 'Date: ' + startDate + '\nUTC Year: ' + startDate['getUTCFullYear']();

startDate.setMilliseconds(startDate.getMilliseconds());
startDate.setSeconds(startDate.getSeconds());
document.getElementById("date2").innerHTML = 'Date: ' + startDate + '\nUTC Year: ' + startDate['getUTCFullYear']();
</script>
</html>




Actual results:

During daylight savings in JavaScript new Date() is initialized with Standard Time timezone.
Once setMilliseconds(0) is called timezone value is correctly changed to Daylight Time (+1h).

Effect is that UTC time goes into past.


Output:
Date: Thu Jan 01 1970 09:40:21 GMT+0930 (ACST) UTC Year: 1970
Date: Thu Jan 01 1970 09:40:21 GMT+1030 (ACST) UTC Year: 1969

TestDate-Firefox.png attached.



Expected results:

Expected output from Safari new Date() timezone initialized as Daylight savings:
Date: Thu Jan 01 1970 10:40:21 GMT+1030 (ACDT) UTC Year: 1970
Date: Thu Jan 01 1970 10:40:21 GMT+1030 (ACDT) UTC Year: 1970
The issue can be replicated with Timezone Adelaide till April when Daylight savings end.
Summary: OSX Javascript new Date() intizlized with Standard Timezone instead of Daylight Savings → OSX Javascript new Date() initialized with Standard Timezone instead of Daylight Savings for Adelaide / ACDT
Blocks: 285663
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
dupe of bug 879261 ?
Experiencing this bug as well in El Capitan:

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

var d = new Date(1446361200000);
d.getTime(); // 1446361200000
d.setMilliseconds(0);
d.getTime(); // 1446364800000


This appears to be different from 879261, although the core cause might be the same.
Dup'ing forward to bug 1346211 which should have fixed this problem. Please reopen if the issue is still present. Thanks!
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: