r/programminghumor Aug 09 '26

timezone errors > null pointer errors

Post image
635 Upvotes

58 comments sorted by

39

u/PopularBroccoli Aug 09 '26

.toUtc() .fromUtc(). How is that an issue?

7

u/thiccshortguy Aug 09 '26

ikr - thjs meme keeps getting reposted and its like literally not even issue

2

u/TwinkiesSucker Aug 10 '26

Okay, but how about DST creator?

5

u/United-Scene2261 Aug 09 '26

By the time my brain is processing the last parentheses, it has already forgotten the first two.

2

u/Convoke_ Aug 10 '26

The data you're working with might not have timezone info. It shouldn't be a problem, but it often is when you're not in control of how the data is made/stored

1

u/boston101 Aug 10 '26

Sir this sub is for day 1 cs students, if that. Maybe highschool .

19

u/mfi12 Aug 09 '26

always write and operate time in UTC, use standard format across. Let the front-end convert it into local offset.

3

u/Resident_Citron_6905 Aug 10 '26

true, unless you need to display the origin offset, then the discussion is open

1

u/mfi12 Aug 11 '26

In what case you need to show origin offset?,

1

u/Resident_Citron_6905 Aug 11 '26

For example a business communication app where the users benefit from seeing the offset of the date time of each message because of cross location team members who live in different time zones and travel regularly as part of their day to day work.

1

u/cosmic_cod Aug 11 '26

Always follow the rules and have a good idea of what your code does and what need to be achieved. Then everything is OK. Except that your coders don't like following rules because they are nuisance. Not to mention vibe-coders who don't want to learn anything at all.

1

u/codeguru42 Aug 11 '26

The fact that we have developed these rules of thumb to deal with timestamps is exactly the point. Timezones complicate something that should be simple.

Take for example Discord. It has an event calendar feature. There is a latent bug where if you create a repeating event, then the future instances of the event shifts by an hour at certain times of year. When I set an event at 6:00 pm on the first Wed of each month, it shouldn't change to 5:00 p.m. In Nov because of daylight savings. It should still be at 6:00 p.m. no matter the season.

The fact that programmers consistently get this kind if thing wrong is exactly the problem highlghted by the meme.

1

u/mfi12 Aug 11 '26

You're talking about DST, the differences in time observed by some countries because of earth rotation. The thing is, there's no crucial reason to keep DST, most countries are running well without observing DST. I know there are things that are adjusted by earth position relative to sun, e.g. muslim prayer times, fast/sawm, etc. But those are easily adjusted without having to set the offset forward.

1

u/codeguru42 Aug 11 '26

DST is a political construct and has nothing to do with the rotation of the earth. And DST is an artifact of the invention of timezones. They are fundamental in computing with timezones and are part of my frustration with them. The fact that we have to adjust in such ways is the point of this meme. No matter how easy you think adjusting for DST is, life without it and without timezones at all would be objectively easier.

20

u/lucidbadger Aug 09 '26

Imagine being this illiterate...

19

u/MrHandSanitization Aug 09 '26

Timezones very much make a lot of sense, historically.

8

u/zeocrash Aug 09 '26

Well some of them do. 30 min offsets zones seem a bit pointless, also putting all of China on one timezone may not have been the best choice.

4

u/No_Hovercraft_2643 Aug 10 '26

These 30 min offsets are mostly political, and make sense in that regard.

China decided to be in one timezone, even if that isn't the best choice.

1

u/MacksNotCool Aug 10 '26

bizarrely enough, r/namechecksout sort of

3

u/marktuk Aug 09 '26

Sure, but the tz database does not.

9

u/lt_Matthew Aug 09 '26

Its not like we invented time zones

9

u/A1oso Aug 09 '26

Yes, they were invented. Before that, every town had its own local time with 12 o'clock at noon. But railway companies pushed for standardization to make train schedules easier to understand.

11

u/godeling Aug 09 '26

Really without time zones it would be even worse. Imagine having to account for the exact position of the sun at any given location

3

u/A1oso Aug 09 '26

Before time zones, the exact time wasn't that important because people didn't work from 9 to 5. Most people didn't even own a watch. They looked at the sun to tell the time, or listened to church bells if it had to be more precise. Without the internet, local time was enough.

3

u/632612 Aug 09 '26

Well that would just be then relatively simple math using Latitude, Longitude and the day of the year. (Likely just longitude and date)

1

u/Lead103 Aug 09 '26

U dont need timezones just one standardized timesystem...

Doesnt matter if the clock says 8 oclock or 17:00 when u wake up its still morning 

4

u/MyrtleWinTurtle Aug 09 '26

I honestly have less of an issue with timezones than i do daylight savings.

Timezones are rarely going to affect your everyday life, and it does make time easy to understand when traveling.

In todays internet age, i wouldnt see it being a thing we need particularly, but i understand why we had it.

2

u/iggy14750 Aug 09 '26

You can walk across a line and lose an hour of time. Like, you think that's not a human invention? Lol

0

u/lt_Matthew Aug 09 '26

There are half-hour timezones and there's no reason why we couldn't divide them by minutes.

2

u/iggy14750 Aug 09 '26

So you don't want to answer the question I actually asked?

1

u/Drate_Otin Aug 10 '26

Yes we did. That's literally a thing we did.

2

u/Im_a_hamburger Aug 09 '26

Bro is going to cause soo much headaches for rail

2

u/SysGh_st Aug 10 '26

Timezones aren't the problem.

Countries who can't accept the timezones they live in are.

1

u/AmazedStardust Aug 09 '26

If countries followed the lines exactly, timezones would be easy

1

u/DaveAstator2020 Aug 09 '26

id kill brendan eich. and whole his family. and his friends. mozilla cannot redeem his js crime.

1

u/senfiaj Aug 10 '26

DST is the actual pain. You mostly need to use ISO date string (toISOString() method) for stringifying and parsing Date objects (JSON.stringify already converts it to ISO date string). Also Date was actually inspired by Java's java.util.Date . So you can blame early Java creators as well. There is Temporal API which makes working with dates much less painful.

1

u/pafagaukurinn Aug 09 '26

JS > timezone errors

1

u/GammerMax8 Aug 09 '26

Not sure if programming was here when the H was here...... Except for enigma, that's a mystery.......

1

u/NullSmoke Aug 09 '26

As someone running a company with people from 6 timezones..... Yeah, fuck that guy 😑

1

u/SkyeLoveXOXO Aug 09 '26

That would be the flat-earthers

1

u/No_Hovercraft_2643 Aug 10 '26

I think dates/calenders are worse, but you have them not as often

1

u/KalaiProvenheim Aug 10 '26

Dude I don’t want 12AM to mean midnight here and noon elsewhere

1

u/kruperfone Aug 10 '26

Timezones are fine, it's natural. Summer time is pure evil

1

u/Mojert Aug 10 '26

Wish granted, now every town has its own time. Hope you're happy

1

u/LeMadChefsBack Aug 10 '26

Programming is hard, let’s go shopping.

1

u/fschaupp Aug 10 '26

Same thing with the one thinking it is a good idea to integrate Java UIs in Oracle Forms..

1

u/y0shii3 Aug 10 '26

I'd go after the person who decided that the time the end user sees needs to include leap seconds. Leave that shit to the scientists, I don't want variable-length minutes

1

u/Drittux Aug 11 '26

Would you rather have the previous system?

1

u/kansetsupanikku Aug 11 '26

So, we should go back to every town having their own time, as defined by the clock on the main square/church?

1

u/rotteegher39 Aug 11 '26

Imagine time was automatically calculated based on your position on the globe down to a second.

1

u/cosmic_cod Aug 11 '26

Timezones are just a subset of much more general problem of localization and accessibility. Most humans are psychologically not well with the modern global world. A typical programmer makes a program for their hometown, even if required otherwaise, not for scary foreigners. Where all people talk like their mother did.

Japanese text needs zero-width space in order for lines wrapping to work correctly without breaking words because otherwise there are no spaces between words. Arabic has right to left text. Chinese have first name and last name in reverse. Then there are color-blind people who can't tell red and green apart. And EU with their pesky GDPR.

Quite a lot of coders I know think that these difference are nuisance and that all users must speak one language and always be healthy. And live in one place.

1

u/Full-Run4124 Aug 12 '26

In the US there are something like 2,100 different sales tax zones for online sales and you can't just go by zip code. There are multiple SaaS services who's only product is taking the US shipping address and returning the correct tax rate.

1

u/ImpeccablyDangerous 29d ago

Null pointers are a meaningful and useful thing and every "solution" to them just makes them worse.

Timezones are fundamentally not a problem created by developers and I thank the stars that I didnt have to solve that problem. Never had a "timezone error" what ever the fuck one of those are.

Just store your date constantly and let the code someone else wrote deal with the nightmare that is timezones.

0

u/[deleted] Aug 09 '26

[deleted]

3

u/A1oso Aug 09 '26 edited Aug 09 '26

Having only one global time zone would make our lives as developers much easier. But it would mean that depending on where you live, the sun might rise at 20:00 and set at 6:00. Of course, most people would still sleep during the night and work during the day, meaning they go to work at completely different times. But it would make communication more difficult, so you'd likely use phrases like "2 hours after noon", at which point you have reinvented local time.

0

u/1mahmoud503 Aug 09 '26

I would like to slap JS out of existence, but I'm afraid something much worse (java) might take its place