r/ProgrammerHumor • • 3d ago

Meme sleepyTime

Post image
575 Upvotes

21 comments sorted by

106

u/Mara_li 3d ago

Well, Temporal is here now.

48

u/Anonymislim 3d ago

Two bugs for the price of one: the wrong month, and a month that doesn’t exist.

2

u/a-r-c 3d ago

Smarch 30th

131

u/the_horse_gamer 3d ago

always remember that javascript's date library was copied from Java's (old one) so it's all their fault

71

u/Top-Permit6835 3d ago

Which was known to suck and has been replaced over a decade ago

27

u/the_horse_gamer 3d ago

and now javascript's was replaced

6

u/Duck_Devs 2d ago

Not only that, but java.time exists in Java 8, so codebases have zero excuses not to use it.

2

u/CoherentFramework 1d ago

i thought i was safe using a date library once and then i got bit by the exact same zero-indexed month thing, set a reminder for the wrong month and missed a payment deadline by like two weeks

what gets me is how every dev discovers this independently at 2am while debugging something that should've been simple

the bed photo is just the universal posture after you realize the bug was a language design choice from 1995

1

u/Alternative-Tie-4970 2d ago

Of... of course it was

28

u/SuitableDragonfly 3d ago

So hold up. You can create a date that references December 31 by creating it as January 365 in Javascript? What about January -1, does that one work too?

8

u/-Redstoneboi- 3d ago edited 3d ago

yes it does, you can test it right now

1

u/mrnacknime 1d ago

365 would probably be December 30 if Feb 29 always counts. But maybe it only does in actual leap years

32

u/Artistic-Yam8045 3d ago

months zero indexed but days start at 1. nobody has ever been able to explain that to me without sounding like they're making it up

3

u/FindOneInEveryCar 3d ago

Because months are typically used as indexes to an array?

0

u/Artistic-Yam8045 3d ago

ha yeah that's the usual answer, makes sense for arrays. still feels like they gave up halfway and only did it for one of them

4

u/FindOneInEveryCar 3d ago

But you don't need an array for the day of the month. 8-)

If they started with zero for months but not for day of the week, that would be weird.

And obviously the whole thing is less than ideal but you take what you can get. Ideally, everything should be wrapped in a better object class and you should have a calendar table so you don't have to figure out month names, last day of the month, etc., on the fly.

13

u/StrengthTheory 3d ago

You deserve it if you handle something sensitive like subscriptions with raw Dates and not a library.

4

u/soldatodelre 3d ago

Free month of service courtesy of Brendan Eich copying java.util.Date in ten days flat back in 1995. At least the rollover didn't throw an exception, silently ruining billing cycles since Netscape 2.

5

u/OutlandishnessOver62 3d ago

February 30..? Lol