I’d make it a named function for clarity and testability and proceed to give zero shits how it is implemented. I would unironically write this code if it worked, but I wouldn’t inline it to reduce the cognitive load of reading it.
Honestly the first one is the only one that works when people define the first day of the week differently. On the other hand, it does make you wonder. If Sunday is the first day of the week (as it is in many places) then how is it also part of the weekend?
But if you’re worried about locale, you can’t assume people use the string “Saturday” to describe Saturday either. That solution only works in English.
“Debugging. The game where you are the criminal, the victim, and the detective at the same time. But you probably don’t know where the crime took place, or what it was. But there definitely is a crime.”
I am a human who transcribes posts to improve accessibility on Lemmy. Transcriptions help people who use screen readers or other assistive technology to use the site. For more information, see here.
programmer_humor
Active
This magazine is from a federated server and may be incomplete. Browse more on the original instance.