2018 / 09 / 22 - log

WTF, JS dates

I know, I know. Javascript is, like most languages, well-known for a lot of weird shit.

But, today, I’m stuck in front of a very… annoying problem.

To put it simply: “Javascript adds some time-zone conversions when rendering a date, and there’s no way to change this behaviour”.

Now, the problem that I’m facing is that I have a formatted ISO8601 date, freshly taken from my local PostgreSQL installation, but when I try to “prettify” it, either I must parse and rebuild the string by hand, or use a third-party library.

For a date format.

Without any conversion.

Am I the only one not thinking that it’s normal ?

Why the fuck should I use a third-party library to pretty much do a str_replace('2019-09-09T00:00:00', 'T', ' '); instead of using a standard method?

PHP has it, Java has it, Golang has it, Rust has it. Even fucking C has everything in its standard library to effortlessly format a date.

And you tell me that the most “hyped” technology nowadays doesn’t have a fucking date format that doesn’t do some ignorable time-zone work?

If I don’t use a fucking third-party library?

Why should I bear another license, node module (potentially node module tree, if they didn’t want to bother writing x % 2 === 0), dependency that may be broken, flawed, and 3rd-party system?

For every javascript dev. out there that think that this situation is bearable, I have a simple question: what in the world is wrong with you, javascript developers?