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

Programmer Humor

37192 readers
455 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 19 points 2 days ago* (last edited 2 days ago) (3 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.

[โ€“] Ephera@lemmy.ml 7 points 2 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...

load more comments (2 replies)