News for hackers. Stuff that matters.
Re:New Date("WTF") – How well do you know JavaScript's Date ... by dcow on Sunday July 13, 2025 @01:50AM (#44547829)
Did you even read TFA? Tell me dates make even the faintest sense.
Re:New Date("WTF") – How well do you know JavaScript's Date ... by hnbad on Sunday July 13, 2025 @09:51AM (#44550466)
`Date` is based on the original Java `Date` class and its API was mostly copied verbatim, explaining a lot of the quirks and silliness. While JS can't remove things easily because that would break the web, a lot of work has gone into a set of time primitives that will effectively replace it. `Date`'s parsing logic is so bad even Java has deprecated it.

This is one of those cases where the problem isn't language design but boardroom politics - Sun wanted JS not to compete with Java so they had to try to make JS more like Java to present JS as a kind of "Java for amateurs".