Strange Date behavior in Chrome

Why these nearly similar date objects give different results in Chrome 37?

var d2014 = new Date(2014, 0, 1);
alert(d2014.getFullYear()); // 2013

var d2015 = new Date(2015, 0, 1);
alert(d2015.getFullYear()); // 2015

In IE11 I get "2014" and "2015" as expected. Browser works in Russian locale. Conversion to strings gives the following results:

d2014.toString();    // Tue Dec 31 2013 23:00:00 GMT+0300 (RTZ 2 (зима))
d2015.toString();    // Thu Jan 01 2015 00:00:00 GMT+0300 (RTZ 2 (зима))

d2014.toUTCString(); // Tue, 31 Dec 2013 20:00:00 GMT
d2015.toUTCString(); // Wed, 31 Dec 2014 21:00:00 GMT

This is a chrome specific issue, you can view the discussion here https://code.google.com/p/v8/issues/detail?id=3116 and in https://code.google.com/p/chromium/issues/detail?id=417640 look for #31 ulan@chromium.org ,

This issue is fixed in version 3.29.39

链接地址: http://www.djcxy.com/p/23078.html

上一篇: 使用Javascript / Jquery滚动到页面上的特定位置

下一篇: Chrome中的奇怪日期行为