<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>137342</bug_id>
          
          <creation_ts>2014-10-02 05:12:24 -0700</creation_ts>
          <short_desc>Incorrect adding time to Date object for January 1st</short_desc>
          <delta_ts>2014-10-02 23:58:48 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows 8</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Igor Kosulin">justvamp</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ggaren</cc>
    
    <cc>mark.lam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1038849</commentid>
    <comment_count>0</comment_count>
    <who name="Igor Kosulin">justvamp</who>
    <bug_when>2014-10-02 05:12:24 -0700</bug_when>
    <thetext>Reproducing:

Run this script:

&lt;script&gt;
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());
&lt;/script&gt;

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&apos;s also pretty weird:

&lt;script&gt;
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());
&lt;script&gt;

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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1039138</commentid>
    <comment_count>1</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2014-10-02 23:58:48 -0700</bug_when>
    <thetext>&lt;rdar://problem/18536183&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>