📜 ⬆️ ⬇️

Chrome who stole christmas

I love my profession. You sit, you touch nobody, you repair primus you write the code. The tester approaches you and says that there is no Christmas in the calendar on the website in 2015. You calmly answer that this does not happen, open the page at your place and show that everything is fine. That's just the tester from this is not easier. Because he really has no Christmas.

Well, you need to look for a problem


The first thing we compare browsers. The error is repeated only in chrome. And for some reason, only testers. We look further. I repeat the actions one to one. The results are different. Starting to sort 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(); true 


RTZ


The riddle was solved and turned out to be very banal. On September 23, Microsoft released update KB2998527 (a separate, more detailed post about this event). As it turned out, the update did not reach all computers, and for some reason the testers were lucky. The only browser that does not work correctly with the new timezone was only chrome. It is worth noting that it is not Christmas that is lost, but each first Wednesday of the new year (apparently due to the transition to summer time, yes). The result - calendars written in js are often wrong and show incorrect dates:

Source: https://habr.com/ru/post/239423/


All Articles