Let's cut to the chase with an example:
new Date('2022-02-09').toLocaleDateString('de-DE')
This outputs 9.2.2022
...which is the wrong format!
The common expected format would be 09.02.2022
!
The first one is not 100% wrong though, it's more like an unusual but tolerated format in Germany. However, what shows in the windows task bar, in apps, in official documents, and so on, is always
09.02.2022
here in Germany. The other just shows sometimes up in handwritten letters.
There are countless related bug reports complaining about this on the web, in all kind of unrelated projects, since ages. Still, it doesn't seem to budge.
So I tried to dig up the "official" format:
-
https://en.wikipedia.org/wiki/Date_format_by_country =>
dd.mm.yyyy
=> OK -
https://gist.github.com/mlconnor/1887156 =>
dd.mm.yyyy
=> OK
I must confess that despite searching for quite some time, I failed too to discover where this "wrong" d.m.yyyy
comes from. Despite every browser seem to implement it, I haven't found the official reference regarding these date format patterns.