this post was submitted on 12 Jul 2025
145 points (98.7% liked)

Programmer Humor

37227 readers
109 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 

cross-posted from: https://programming.dev/post/33754840

new Date("wtf")

you are viewing a single comment's thread
view the rest of the comments
[–] kinttach@lemmy.zip 20 points 4 days ago* (last edited 4 days ago) (2 children)

In the process of being replaced.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal

JavaScript has had the Date object for handling date and time since its first days. However, the Date API is based on the poorly designed java.util.Date class from Java, which was replaced in the early 2010s; but, because of JavaScript's goal of backward compatibility, Date sticks around in the language.

[–] sp3ctr4l@lemmy.dbzer0.com 16 points 4 days ago (1 children)

Damn, I thought you meant JavaScript itself was being replaced.

[–] jimi_henrik@lemmy.world 15 points 4 days ago

One can only undefined

[–] Ephera@lemmy.ml 7 points 4 days ago

Hmm, I can believe that it was based on java.util.Date, but I don't remember that being as unpredictable. I guess, a different API to begin with, would have avoided a lot of problems, though...