3 ms·
Temporal's main data type is ZonedDateTime. PlainDateTime is there because it is necessary sometimes. The Temporal docs even outline some cases where you might
by burntsushi 2y ago
Temporal's main data type is ZonedDateTime.
PlainDateTime is there because it is necessary sometimes. The Temporal docs even outline some cases where you might want to use it: https://tc39.es/proposal-temporal/docs/plaindatetime.html https://tc39.es/proposal-temporal/docs/plaindatetime.html
Temporal also makes it pretty hard to misuse its types. For example:
>> dt = Temporal.PlainDateTime.from("2025-01-25T00:00Z")
Uncaught RangeError: Z designator not supported for PlainDateTime
ToTemporalDateTime ecmascript.mjs:1198
from plaindatetime.mjs:286
<anonymous> debugger eval code:1