Closed r-k-b closed 3 years ago
Moment has access to the local timezone via the Browser, which Elm does not have.
The third option is really the only feasible path forward, although it is a valid ISO8601 format, just ambiguous as you point out.
Ultimately though this library is meant to be a pragmatic tool, not a perfect tool. It serves our needs to very quickly parse time strings for use in grouping by hour and date (which is why we don't use Posix internally).
I will think about this for a while.
This silently corrupts incoming data that isn't already known to have an offset of zero.
For example, when parsing user input which is implicitly in their local time:
The output is incorrectly given an arbitrary offset.
Some options:
offset
s.This fabrication of made-up timezones also affects date-only strings. The following example converts some local Date to the Date specific to zones with a zero offset:
For reference, Moment.js appears have different behaviour, treating local times as runtime-specific. For example: