this post was submitted on 24 Mar 2026
90 points (98.9% liked)

Programming

26225 readers
285 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 2 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
[–] bleistift2@sopuli.xyz 14 points 1 day ago (1 children)

If you think looking at Thursday seems like a random choice: It’s basically a majority vote among the days of the week. If Thursday is in the new year, then 4 days (Thu–Sun) are in the new year. If Thursday is in the old year, then 4 days are in the old year (Mon–Thu).

[–] ttayh@lemmy.zip 15 points 1 day ago (2 children)

The 1st day of the feek is not universal. I grew up with the week starting on sunday

[–] bleistift2@sopuli.xyz 14 points 1 day ago (1 children)

Yes, another thing in the neverending list of shit you have to learn at some point if you’re any kind of programmer.

Some people start their week on the wrong day.

[–] TehPers@beehaw.org 3 points 1 day ago

Like ISO 8601. /s

[–] sergiu@lemmy.world 6 points 1 day ago (3 children)

Is this a thing outside the USA? It always bugs me when apps default to this. How does it make any sense for the week to start with the weekend?

[–] brisk@aussie.zone 6 points 1 day ago (1 children)
[–] sergiu@lemmy.world 2 points 21 hours ago

A string is reversible, a week is not. A week has a beginning and an end.

[–] technohacker@programming.dev 2 points 1 day ago (1 children)

I've generally seen Sunday to be the start of the week here, my current headcanon for it is that Sunday and Saturday sort of book-end on both sides of the week, hence week-end_s_ plural

[–] sergiu@lemmy.world 1 points 21 hours ago* (last edited 21 hours ago) (2 children)

I'm just curious how this works in practice.

When you say something like "Let's meet up this weekend", is it implied that you will meet on Saturday, since Sunday is the other end of next week, so technically a different weekend?

[–] locuester@lemmy.zip 1 points 21 minutes ago

The weekend, and more specifically “this weekend” or “this coming weekend” means both days - Saturday and Sunday.

Sunday being a part of next week on a written calendar does not even register as a potential date “problem” with my brain in day-to-day talk.

[–] technohacker@programming.dev 2 points 21 hours ago

Not quite sure actually, I think we end up specifying a day or implicitly consider both of them

[–] bleistift2@sopuli.xyz 2 points 1 day ago

God rested on the seventh day, but Sabbath is on Saturday. Tadaa, week starts on Sunday.