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

Programmer Humor

37734 readers
339 users here now

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

Rules:

founded 6 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 1 month ago* (last edited 1 month 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 18 points 1 month ago (1 children)

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

[–] jimi_henrik@lemmy.world 16 points 1 month ago

One can only undefined

[–] Ephera@lemmy.ml 7 points 1 month 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...