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

  • SleeplessCityLights
    link
    fedilink
    arrow-up
    3
    ·
    12 hours ago

    Fuck, I just wrote an app to help HR process data and I had to, without using Ai, define the first week of the year to match that ISO spec. Week 53 was a fun one but I now have to cover two weeks with the same number.