this post was submitted on 24 Mar 2026
93 points (96.0% liked)

Programming

27131 readers
297 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 3 years ago
MODERATORS
 

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

you are viewing a single comment's thread
view the rest of the comments
[–] SleeplessCityLights@programming.dev 7 points 2 months ago (1 children)

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.

[–] folekaule@lemmy.world 9 points 2 months ago (2 children)

Yep, but the year of week will be different for each.

Use a date library. Life is too short to make your own. The new Temporal library in JavaScript is quite good.

[–] SleeplessCityLights@programming.dev 5 points 2 months ago (1 children)
[–] Valmond@lemmy.dbzer0.com 1 points 2 months ago

As all good libraries are 😎

[–] bleistift2@sopuli.xyz 1 points 2 months ago (1 children)

The new Temporal library in JavaScript is quite good.

Sadly, Safari fucks us yet again.

[–] sukhmel@programming.dev 1 points 2 months ago (1 children)
[–] bleistift2@sopuli.xyz 1 points 2 months ago (1 children)

Well, Safari is the only browser not to support the new Temporal API.

[–] sukhmel@programming.dev 2 points 2 months ago

Ah, I thought they actively broke it somehow