WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
92782
Error in Date.setMonth()
https://bugs.webkit.org/show_bug.cgi?id=92782
Summary
Error in Date.setMonth()
rgunnyon
Reported
2012-07-31 12:10:40 PDT
There is an error in setMonth that seems to crop up on even numbered months. This is taken from the console of the nightly build: d=new Date() Tue Jul 31 2012 11:32:27 GMT-0700 (Pacific Daylight Time) d.getMonth() 6 d.setMonth(8) 1349116347499 d Mon Oct 01 2012 11:32:27 GMT-0700 (Pacific Daylight Time) d.setMonth(8) 1346524347499 d Sat Sep 01 2012 11:32:27 GMT-0700 (Pacific Daylight Time) Setting the month to the same value twice had an incorrect setting first, then the correct setting.
Attachments
Demonstrates the failure in setMonth()
(579 bytes, text/html)
2012-08-01 13:07 PDT
,
rgunnyon
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2012-08-01 12:44:21 PDT
I cannot reproduce this. Could you please attach a complete HTML test case that can be opened to easily see a pass/fail result?
rgunnyon
Comment 2
2012-08-01 13:07:08 PDT
Created
attachment 155865
[details]
Demonstrates the failure in setMonth() This bug appears if you set the month to an even value when the current date is the 31st day of a month. A second call sets the correct value.
rgunnyon
Comment 3
2012-08-02 09:04:23 PDT
I poked at it a bit more, this appears to be a 'gotcha' with date normalization. From the 31st, setting the month to one that doesn't have a 31st day triggers the shift to 1st, 2nd or 3rd of the next month. The second call to setmonth sets it to the 1st, 2nd or 3rd of the correct month.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug