@@Rolf B
Von
(new Date(2026,2,20)).toISOString()bekommst Du in Deutschland immer 23 oder 22 Uhr des Vortages, weil wir GMT+1 oder +2 sind.Ja, JavaScript ist hier fehlkonstruiert.
So gut wie alle Programmiersprachen sind hier fehlkonstruiert, weil man mit 2026,2,20 nicht den 20. Februar, sondern den 20. März bekommt. Dass man Array-Indizes bei 0 anstatt bei 1 anfängt zu zählen, ist schon schlimm genug; bei Monaten ist es eine Katastrophe.
Aber das mit der Uhrzeit lässt sich in Griff bekommen. Nicht lokale Zeit rein, UTC raus; sondern UTC rein, UTC raus:
(new Date(Date.UTC(2026,2,20))).toISOString() // "2026-03-20T00:00:00.000Z"
Oder ein vernüftiges API verwenden:
Weshalb Temporal gebaut wurde.
🖖 Live long and prosper
--
In our chants of “ICE out now”
Our city’s heart and soul persists
Through broken glass and bloody tears
On the streets of Minneapolis
— Bruce Springsteen, Streets of Minneapolis
In our chants of “ICE out now”
Our city’s heart and soul persists
Through broken glass and bloody tears
On the streets of Minneapolis
— Bruce Springsteen, Streets of Minneapolis