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…
Why are 2025/05/28 and 2025-05-28 different days in JavaScript?
41–50 of 167 posts
Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?
#42How 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.
Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?
#43Hang 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…
How is slashes ambiguous if you use YYYY and in YMD order?
Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?
#44Earlier quoted context omitted.
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?
#45Special shoutouts to the author of node-postgres saying the PG's date type is better not used for dates in this case.[1] I love programming.
[1] https://node-postgres.com/features/types#date--timestamp--ti...
Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?
#46In Sweden, we can write dates as 28/5-25
Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?
#47Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?
#48Undocumented Undefined Behaviour, anyone?
The real "bug" in the example is 2025/05/28 being May 28th because the implementation ignores timezones for that format.
The issue with `Date` is that it is based on the original `java.util.Date` class and inherits all of its problems: https://docs.oracle.com/en/java/javase/21/docs/api/java.base... - this is also where the wonky zero-indexed month value comes from. Note that Java deprecated all versions of the constructor other than the one taking a millisecond value or nothing, which JS can't do for backwards compatibility reasons.
Hopefully `Temporal` will solve these problems but how long that spec has been in the works should tell you how difficult this is to get right when anything you put on the web is forever.
Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?
#49Re: Why are 2025/05/28 and 2025-05-28 different days in JavaScript?
#50Earlier quoted context omitted.
How is slashes ambiguous if you use YYYY and in YMD order?
Because Americans use slashes commonly in Y/D/M
I had never seen Y/D/M. I almost never see American use Day/Month order to begin with, let alone Y/D/M.