[Webkit-unassigned] [Bug 137342] New: Incorrect adding time do Date object for January 1st

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Oct 2 05:12:25 PDT 2014


https://bugs.webkit.org/show_bug.cgi?id=137342

           Summary: Incorrect adding time do Date object for January 1st
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Windows 8
            Status: NEW
          Severity: Major
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: justvamp at gmail.com


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

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list