Chrome stole Christmas

    I love my profession. You sit, don’t touch anyone, you fix a primus, you write a code. A tester approaches you and says that in the calendar on the site in 2015 there is no Christmas. You calmly reply that this does not happen, open the page at your place and show that everything is fine. Here are just a tester from this is not easier. Because he really has no Christmas.

    Well, look for a problem

    The first thing we do is compare browsers. The error is repeated only in chrome. And for some reason, only with testers. We look further. I repeat the actions one to one. The results come out different. We start sorting through the dates:

    new Date(2015, 0, 6);
    Tue Jan 06 2015 00:00:00 GMT+0300 (RTZ 2 (зима))
    new Date(2015, 0, 7);
    Tue Jan 06 2015 23:00:00 GMT+0300 (RTZ 2 (зима))
    new Date(2015, 0, 8);
    Thu Jan 08 2015 00:00:00 GMT+0400 (RTZ 2 (лето))

    Compare with my result:

    new Date(2015, 0, 7);
    Wed Jan 07 2015 00:00:00 GMT+0300 (Russian Standard Time)

    And a funny consequence:

    new Date(2015, 0, 6).getDate() === new Date(2015, 0, 7).getDate();


    The riddle was solved and turned out to be very commonplace. On September 23, Microsoft released update KB2998527 (a separate, more detailed post about this event). As it turned out, the update didn’t reach all computers, and for some reason testers were lucky most. The only browser that did not work correctly with the new timezone was only chrome. It is worth noting that it is not Christmas that disappears, but every first Wednesday of the new year (apparently in connection with the transition to daylight saving time, yes). Result - calendars written in js are often mistaken and show incorrect dates:

    Also popular now: