Closed Bug 756063 Opened 13 years ago Closed 13 years ago

setMonth sets incorrect month for GMT+6 location

Categories

(Core :: JavaScript Engine, defect)

12 Branch
x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: hsalkaline, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.168 Safari/535.19 Steps to reproduce: set system to Yekaterinburg(GMT +6) execute the code var d = new Date(1981, 2, 1); d.setMonth(3); Actual results: d.getMonth() returns 2 Expected results: d.getMonth() shold return 3
"set system" should be read like "set system location/time zone"
Assignee: nobody → general
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
QA Contact: untriaged → general
same bug appears even for just constructing a Date, such as new Date(1981, 3, 1)
Probably due to some sort of mixing of local time and GMT... What does toString() on the date look like after the constructor call in comment 2?
(In reply to Boris Zbarsky (:bz) from comment #3) > Probably due to some sort of mixing of local time and GMT... What does > toString() on the date look like after the constructor call in comment 2? Tue Mar 31 1981 23:00:00 GMT+0500 (SVET) I also tried the above code in firefox under windows, and it worked as expected. I get incorrect result only in firefox under ubuntu 12.04
What does the toString() look like on Windows? Same thing?
(In reply to Boris Zbarsky (:bz) from comment #5) > What does the toString() look like on Windows? Same thing? it's "Wed Apr 01 1981 00:00:00 GMT+0600"
Right. So your Windows machine thinks that date is on daylight savings time, while Ubuntu thinks it's on winter time? The arguments passed to the constructor are interpreted as midnight daylight savings time in both cases, looks like. Or something. I'm not sure how else to interpret the difference in timezone those two strings show. Chances are, this is a bug in the system timezone data...
(In reply to Boris Zbarsky (:bz) from comment #7) > Right. So your Windows machine thinks that date is on daylight savings > time, while Ubuntu thinks it's on winter time? The arguments passed to the > constructor are interpreted as midnight daylight savings time in both cases, > looks like. Or something. I'm not sure how else to interpret the > difference in timezone those two strings show. > > Chances are, this is a bug in the system timezone data... I think you're right, that's system timezone data issue. that's output of zdump on my linux machine zdump -v Asia/Yekaterinburg|grep 1981 Asia/Yekaterinburg Tue Mar 31 18:59:59 1981 UTC = Tue Mar 31 23:59:59 1981 SVET isdst=0 gmtoff=18000 Asia/Yekaterinburg Tue Mar 31 19:00:00 1981 UTC = Wed Apr 1 01:00:00 1981 SVEST isdst=1 gmtoff=21600 Asia/Yekaterinburg Wed Sep 30 17:59:59 1981 UTC = Wed Sep 30 23:59:59 1981 SVEST isdst=1 gmtoff=21600 Asia/Yekaterinburg Wed Sep 30 18:00:00 1981 UTC = Wed Sep 30 23:00:00 1981 SVET isdst=0 gmtoff=18000 Thank you for your effort
OK, seems not to be a Firefox bug then. Please reopen if that's incorrect.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.