Temporal.ToInstantOptions - Web documentation
type alias Temporal.ToInstantOptions
Unstable

Options for conversions of Temporal.PlainDateTime to Temporal.Instant

Properties

optional
disambiguation:
"compatible"
| "earlier"
| "later"
| "reject"

Controls handling of invalid or ambiguous times caused by time zone offset changes like Daylight Saving time (DST) transitions.

This option is only relevant if a DateTime value does not exist in the destination time zone (e.g. near "Spring Forward" DST transitions), or exists more than once (e.g. near "Fall Back" DST transitions).

In case of ambiguous or nonexistent times, this option controls what exact time to return:

  • 'compatible': Equivalent to 'earlier' for backward transitions like the start of DST in the Spring, and 'later' for forward transitions like the end of DST in the Fall. This matches the behavior of legacy Date, of libraries like moment.js, Luxon, or date-fns, and of cross-platform standards like RFC 5545 (iCalendar).
  • 'earlier': The earlier time of two possible times
  • 'later': The later of two possible times
  • 'reject': Throw a RangeError instead

The default is 'compatible'.