WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
137342
Incorrect adding time to Date object for January 1st
https://bugs.webkit.org/show_bug.cgi?id=137342
Summary
Incorrect adding time to Date object for January 1st
Igor Kosulin
Reported
2014-10-02 05:12:24 PDT
Reproducing: Run this script: <script> var dt = new Date(); dt.setYear(2008); // any of these years: 1991, 2002, 2008, 2013, 2019, 2030, 2036, 2041, 2047, 2058... dt.setMonth(0, 1); // January 1st dt.setHours(23); dt.setMinutes(30); dt.setSeconds(0); console.log(dt.toString()); dt.setMinutes(dt.getMinutes() + 30) console.log(dt.toString()); </script> Excepted result (it works this way for other dates/years): Thu Jan 01 2008 23:30:00 GMT+0300 Fri Jan 02 2008 00:00:00 GMT+0300 But we have: Tue Jan 01 2008 23:30:00 GMT+0300 Tue Jan 01 2008 23:00:00 GMT+0300 This bug seems to be reproduced only for January 1st and only for years like 1991, 2002, 2008, 2013, 2019, 2030, 2036, 2041, 2047, 2058... === Also please take a look at another testcase. It's also pretty weird: <script> var dt = new Date(); dt.setYear(2008); // any of these years: 1991, 2002, 2008, 2013, 2019, 2030, 2036, 2041, 2047, 2058... dt.setMonth(0, 1); // January 1st dt.setHours(23); dt.setMinutes(30); dt.setSeconds(0); console.log(dt.toString()); var dt2 = new Date(dt.getTime() + 30 * 60000); console.log(dt2.toString()); <script> Excepted result (it works this way for other dates/years): Thu Jan 01 2008 23:30:00 GMT+0300 Fri Jan 02 2008 00:00:00 GMT+0300 But we have: Tue Jan 01 2008 23:30:00 GMT+0300 Wed Jan 02 2008 01:00:00 GMT+0400
Attachments
Add attachment
proposed patch, testcase, etc.
Geoffrey Garen
Comment 1
2014-10-02 23:58:48 PDT
<
rdar://problem/18536183
>
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