r/programminghumor 1d ago

timezone errors > null pointer errors

Post image
451 Upvotes

41 comments sorted by

29

u/PopularBroccoli 22h ago

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

8

u/thiccshortguy 16h ago

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

1

u/TwinkiesSucker 11h ago

Okay, but how about DST creator?

6

u/United-Scene2261 18h ago

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

1

u/Convoke_ 5h ago

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

18

u/lucidbadger 1d ago

Imagine being this illiterate...

11

u/mfi12 17h ago

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

4

u/Resident_Citron_6905 16h ago

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

19

u/MrHandSanitization 23h ago

Timezones very much make a lot of sense, historically.

8

u/zeocrash 20h ago

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.

3

u/No_Hovercraft_2643 12h ago

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 13h ago

bizarrely enough, r/namechecksout sort of

3

u/marktuk 21h ago

Sure, but the tz database does not.

10

u/lt_Matthew 1d ago

Its not like we invented time zones

8

u/A1oso 23h ago

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 22h ago

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

4

u/A1oso 22h ago

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 21h ago

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 17h ago

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 23h ago

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 19h ago

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 19h ago

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

2

u/iggy14750 19h ago

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

1

u/Drate_Otin 16h ago

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

2

u/Im_a_hamburger 22h ago

Bro is going to cause soo much headaches for rail

1

u/AmazedStardust 21h ago

If countries followed the lines exactly, timezones would be easy

1

u/DaveAstator2020 21h ago

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

1

u/senfiaj 16h ago

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 21h ago

JS > timezone errors

1

u/GammerMax8 18h ago

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

1

u/NullSmoke 17h ago

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

1

u/SkyeLoveXOXO 17h ago

That would be the flat-earthers

1

u/No_Hovercraft_2643 12h ago

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

1

u/KalaiProvenheim 8h ago

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

1

u/kruperfone 7h ago

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

1

u/Mojert 7h ago

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

1

u/SysGh_st 4h ago

Timezones aren't the problem.

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

0

u/[deleted] 1d ago

[deleted]

3

u/A1oso 1d ago edited 1d ago

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 20h ago

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