Comment by tshaddox
> JavaScript date parsing assumes that dates that lack the trailing Z are in the client time zone.
The situation is in fact even worse than this. The current (ECMA262) spec states:
> When the time zone offset is absent, date-only forms are interpreted as a UTC time and date-time forms are interpreted as a local time.
This is in fact a huge bug in the spec, which was initially unintentional but is now deliberately preserved for web compatibility reasons.
More info here:
https://maggiepint.com/2017/04/11/fixing-javascript-date-web...
That is good context, thanks! Once I found my bug I had a moment of not being sure who to blame. Honestly, I'm a bit surprised that the ISO8601 spec dictates that absent the Z the date-time ought to be interpreted as local. At the least, I expected there would at least be a way for me to say "trust me JS, this date is UTC so please parse it that way" - but the only way I could find to force that to happen was to manually add a "Z".
But the insanity of inconsistently choosing local/UTC based on the presence of time is genuinely painful. Dates and times are hard enough as it is, why would they do that? It gives me some amusement that this was one of the motivating use cases behind the Temporal spec.