2 ms·
The first format makes no fucking sense to start with, the US is the main country which uses mid-endian dates and it doesn't use "-" as a separator. But beyond
by masklinn 4y ago
The first format makes no fucking sense to start with, the US is the main country which uses mid-endian dates and it doesn't use "-" as a separator.
But beyond that, don't use `new Date(string)`: the only spec-defined format is a restricted ISO 8601[0], though the horror show that is RFC 2822 datetimes is conventionally supported by everybody because it's the standard stringification (Date#toString).
Everything else is implementation-defined, and likely heuristic.
[0] https://tc39.es/ecma262/#sec-date-time-string-format https://tc39.es/ecma262/#sec-date-time-string-format