Live data from Hacker News

Why are 2025/05/28 and 2025-05-28 different days in JavaScript?

brandondong.github.io

21–30 of 167 posts

Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?

#22
post #12
post #7

Hang on, slashes and year-month-day? https://en.wikipedia.org/wiki/ISO_8601 Handed down by the ISO, The Great Compromise allows YYYY-MM-DD (or YYYYMMDD if you're in a hurry) but the version with slashes I'd find ambiguous and upsetting, especially early in the month. The standard is good, and you can get it from `date -I`. Hell mend anyone who messes with the delimiters or writes the year in octal or any other heresy…

Pro tip: never ever use anything but ISO dates in UTC tz unless you're displaying it for a user in a UI.

RFC3339.

ISO 8601 allows for 2 or 6 digit years. Truncating to 2 is just incorrect, and 6 digits is absurd. And you can read the RFC without paying ISO - and you can discuss the RFC with people who have also read it instead of relying on people using the Wikipedia page to interpret and explain ISO 8601.

I have a scheduling service at work and I keep getting requests for implementing ISO 8601 timestamps but I ignore them. RFC3339 is the way forward.

Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?

#23
post #8
post #6

How did they manage to build the entire modern Web on a language without a standard library?

The world where JavaScript has a robust standard library is one where there is only one browser vendor who gets to call all the shots regarding what the web looks like. That is not a better world.

Possibly, although the fix for this particular issue (Temporal API) is available in the current release of Firefox as well as the preview release of Safari, but it's not in that dominant browser.

Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?

#24
post #8
post #6

How did they manage to build the entire modern Web on a language without a standard library?

The world where JavaScript has a robust standard library is one where there is only one browser vendor who gets to call all the shots regarding what the web looks like. That is not a better world.

Actually it is. Sorry.

Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?

#28
post #9
post #6

How did they manage to build the entire modern Web on a language without a standard library?

There's even worse language language for this. It's absolutely essential for an modern e-commerce, but has no official standard or spec, many thousands of libraries but they're mostly poorly maintained and geoblocked. The language itself is just a hodge podge of other languages that were popular in the past, and as a result it's worse than Perl for having too many ways to do any single thing. The major dialects may b…

PHP?

Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?

#29
post #8
post #6

How did they manage to build the entire modern Web on a language without a standard library?

The world where JavaScript has a robust standard library is one where there is only one browser vendor who gets to call all the shots regarding what the web looks like. That is not a better world.

Kind of funny that you think the open web still exists.

I mean, even Microsoft gave up and just went with Chromium, and they got the definition of almost infinite resources at their disposal.

Effectively if your website doesn't run in Chrome and Safari, it won't be seen by 99% of the market.

Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?

#30
post #12

Earlier quoted context omitted.

Pro tip: never ever use anything but ISO dates in UTC tz unless you're displaying it for a user in a UI.

RFC3339. ISO 8601 allows for 2 or 6 digit years. Truncating to 2 is just incorrect, and 6 digits is absurd. And you can read the RFC without paying ISO - and you can discuss the RFC with people who have also read it instead of relying on people using the Wikipedia page to interpret and explain ISO 8601. I have a scheduling service at work and I keep getting requests for implementing ISO 8601 timestamps but I ignore t…

There's this handy venn diagram that I've seen floating around for a long time.

Just found a random link to it with an image search:

https://gyazo.com/d8517f72e24c38f055e17182842b991c/max_size/...

ISO 8601 does have some strange formats...

Post reply on HN