this post was submitted on 16 Nov 2023
3 points (100.0% liked)

Programmer Humor

25040 readers
1086 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 

Yes, someone actually did this and I found it running on our server

top 11 comments
sorted by: hot top controversial new old
[–] xmunk@sh.itjust.works 2 points 2 years ago* (last edited 2 years ago) (1 children)

As a Real Programmer(tm) I have developed such a deep fear of anything time and date related that I would fully endorse dispatching an API call to the tz_database instead of attempting any fucking part of this.

Kids, it's fine to meme about silly stuff... but date and time is deadly serious, regardless of how careful you think you're being you are wrong.

Do you know how many timezones there are in Indiana? No? Look it up and scream in horror.

[–] sunbeam60@lemmy.one 2 points 2 years ago

What if I told you that weekend days are locale dependent?!

Time and date is the black hole where optimistic programmers go to die. Nothing is simply with localisation and if you think it is, you mustn’t have worked enough with it.

Source: Run a system that schedules millions of interactions across the world and deeply depend on this. The amount of code to manage and/or call out to external services to give us information about time zones, summer time, locale specific settings, day names, calendar systems, week numbers etc etc.

[–] space@lemmy.dbzer0.com 1 points 2 years ago (1 children)

You want to expand your business to Europe. Bam, your code is broken, in Europe the week starts on Monday.

Than you want to expand to the middle east. Bam, broken again... Because in arab countries and Israel, the weekend is on Friday and Saturday.

Then you want to expand to Mexico and India. Bam, broken again, their weekend is only on Sunday.

[–] kogasa@programming.dev 1 points 2 years ago (1 children)

The obvious solution is to inject an IWeekendDaysOfWeekProvider service in the inversion of control container. In your, uh, javascript web app.

[–] coloredgrayscale@programming.dev 1 points 2 years ago* (last edited 2 years ago)

Just npm install isWeekend for the required locales.

Depends on: isMonday, isTuesday,...

[–] Matombo@feddit.de 1 points 2 years ago (1 children)

Ok another US local units are retarded rant: it's called weekEND! why do you start your week at sunday and not monday! Sunday is part of the weekEND!

[–] MrScottyTay@sh.itjust.works -1 points 2 years ago (1 children)

I'm English, not American but I see it as Saturday and Sunday are the two ends of the week. Like how a string has two ends. The weekend is both the start and the finishing end of the week.

[–] ChrissieWF@discuss.tchncs.de 1 points 2 years ago

So, when someone asks if you are free the next two weekends, you assume they're talking about the next Saturday (tail weekend) and the next Sunday (front weekend)?

[–] dauerstaender@feddit.de 1 points 2 years ago (1 children)

Why would you call it weekend and the start the week with half of it?!

[–] DroneRights@lemm.ee -1 points 2 years ago (1 children)

A rope has two ends, and so does a week

[–] DrunkenPirate@feddit.de 1 points 2 years ago

Sentences have both meanings and sound, yours have sound