null4141

joined 1 day ago
[โ€“] null4141@programming.dev 2 points 9 hours ago

That video is a classic. It's exactly why I put "it has nothing to do with timezones" as subtitle for the post :) That was my first guess when I encountered the bug, before I realized it was about the ISO weeks.

And in the end of the post I also added a list of falsehoods, different from your link tho: https://gist.github.com/timvisee/fcda9bbdff88d45cc9061606b4b923ca

[โ€“] null4141@programming.dev 2 points 9 hours ago

This is basically the takeaway from my blog post, if you're going to use weeks, use the ISO year instead of the calendar year :)

 

The other day at work I stumbled upon this bug and thought it was worth to write a blog post about. Spoiler: It has nothing to do with timezones!

TLDR: According to ISO standard 8601 (which is what Python's date.isocalendar().week uses for example), the first week of the year is the week with the first Thursday of the year. So sometimes the first few days of January belong to the last week of previous year, and sometimes the last few days of December belong to the first week of next year :D