Bug 137140 - Date.getDate() returns bad values in some time zones
Summary: Date.getDate() returns bad values in some time zones
Status: RESOLVED DUPLICATE of bug 137003
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Macintosh Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-09-25 22:45 PDT by Daniel Herbolt
Modified: 2014-09-30 14:47 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Herbolt 2014-09-25 22:45:03 PDT
Steps to reproduce
1) Set time zone of your OS X to Sydney - Australia
2) run following code in Safari Developer console
 a)
 //Date '2014-10-05' is the first Sunday in October. It is date when DST is changing in Australia.
 var d = new Date(2014, 9, 5, 0, 0, 0, 0); // 2014-10-05 00:00:00
 d.toString();

 b) new Date(2014, 9, 5, 0, 0, 0, 0).getDate();
3) see result in console

Expexcted result:
2a) Sun Oct 05 2014 00:00:00 GMT+1000 (EST)
2b) 5

Actual result:
2a) Sat Oct 04 2014 23:00:00 GMT+1000 (EST)
2b) 4


Additional info:
 - APPLE BUG ID #13201479
 - http://www.timeanddate.com/time/aboutdst.html
 - http://stackoverflow.com/questions/14839244/why-is-safari-confused-about-date-getday-for-dst-start-in-sydney-aus-time-zon

 - It is also reproducible with New Zealand time zone with different date. Affected date is date of DST change.


Used software
Safari 7.1, Safari 8.0
Comment 1 Alexey Proskuryakov 2014-09-29 16:45:45 PDT
Same as bug 137003?
Comment 2 Daniel Herbolt 2014-09-29 22:46:55 PDT
(In reply to comment #1)
> Same as bug 137003?

Yes, it looks as the same problem for New Zealand time zone.

1) Set time zone of your OS X to Wellington - New Zealand
2) run following code in Safari Developer console
 a)
 var d = new Date(2014, 8, 28, 0, 0, 0, 0);
 d.toString();

 b) new Date(2014, 8, 28, 0, 0, 0, 0).getDate();
3) see result in console

Expexcted result:
2a) Sun Sep 28 2014 00:00:00 GMT+1200 (NZST)
2b) 28

Actual result:
2a) Sat Sep 27 2014 23:00:00 GMT+1200 (NZST)
2b) 27
Comment 3 Alexey Proskuryakov 2014-09-30 14:47:43 PDT
Thank you for confirming, duping to the older bug.

*** This bug has been marked as a duplicate of bug 137003 ***