A Temporal.ZonedDateTime object is an Object referencing a fixed point in time with nanoseconds precision, and containing Object values corresponding to a particular time zone and calendar system.
Properties of the Temporal.ZonedDateTime Prototype Object
The Temporal.ZonedDateTime prototype object
- is itself an ordinary object.
- is not a Temporal.ZonedDateTime instance and does not have a [[InitializedTemporalZonedDateTime]] internal slot.
- has a [[Prototype]] internal slot whose value is %Object.prototype%.
An ECMAScript implementation that includes the ECMA-402 Internationalization API extends this prototype with additional properties in order to represent calendar data.
Temporal.ZonedDateTime.prototype.constructor
The initial value of `Temporal.ZonedDateTime.prototype.constructor` is %Temporal.ZonedDateTime%.
Temporal.ZonedDateTime.prototype[ %Symbol.toStringTag% ]
The initial value of the %Symbol.toStringTag% property is the String value *"Temporal.ZonedDateTime"*.
This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.
get Temporal.ZonedDateTime.prototype.calendarId
`Temporal.ZonedDateTime.prototype.calendarId` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Return _zonedDateTime_.[[Calendar]].
get Temporal.ZonedDateTime.prototype.timeZoneId
`Temporal.ZonedDateTime.prototype.timeZoneId` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Return _zonedDateTime_.[[TimeZone]].
get Temporal.ZonedDateTime.prototype.era
`Temporal.ZonedDateTime.prototype.era` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return CalendarISOToDate(_zonedDateTime_.[[Calendar]], _isoDateTime_.[[ISODate]]).[[Era]].
get Temporal.ZonedDateTime.prototype.eraYear
`Temporal.ZonedDateTime.prototype.eraYear` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Let _result_ be CalendarISOToDate(_zonedDateTime_.[[Calendar]], _isoDateTime_.[[ISODate]]).[[EraYear]].
1. If _result_ is *undefined*, return *undefined*.
1. Return 𝔽(_result_).
get Temporal.ZonedDateTime.prototype.year
`Temporal.ZonedDateTime.prototype.year` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return 𝔽(CalendarISOToDate(_zonedDateTime_.[[Calendar]], _isoDateTime_.[[ISODate]]).[[Year]]).
get Temporal.ZonedDateTime.prototype.month
`Temporal.ZonedDateTime.prototype.month` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return 𝔽(CalendarISOToDate(_zonedDateTime_.[[Calendar]], _isoDateTime_.[[ISODate]]).[[Month]]).
get Temporal.ZonedDateTime.prototype.monthCode
`Temporal.ZonedDateTime.prototype.monthCode` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return CalendarISOToDate(_zonedDateTime_.[[Calendar]], _isoDateTime_.[[ISODate]]).[[MonthCode]].
get Temporal.ZonedDateTime.prototype.day
`Temporal.ZonedDateTime.prototype.day` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return 𝔽(CalendarISOToDate(_zonedDateTime_.[[Calendar]], _isoDateTime_.[[ISODate]]).[[Day]]).
get Temporal.ZonedDateTime.prototype.hour
`Temporal.ZonedDateTime.prototype.hour` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return 𝔽(_isoDateTime_.[[Time]].[[Hour]]).
get Temporal.ZonedDateTime.prototype.minute
`Temporal.ZonedDateTime.prototype.minute` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return 𝔽(_isoDateTime_.[[Time]].[[Minute]]).
get Temporal.ZonedDateTime.prototype.second
`Temporal.ZonedDateTime.prototype.second` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return 𝔽(_isoDateTime_.[[Time]].[[Second]]).
get Temporal.ZonedDateTime.prototype.millisecond
`Temporal.ZonedDateTime.prototype.millisecond` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return 𝔽(_isoDateTime_.[[Time]].[[Millisecond]]).
get Temporal.ZonedDateTime.prototype.microsecond
`Temporal.ZonedDateTime.prototype.microsecond` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return 𝔽(_isoDateTime_.[[Time]].[[Microsecond]]).
get Temporal.ZonedDateTime.prototype.nanosecond
`Temporal.ZonedDateTime.prototype.nanosecond` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return 𝔽(_isoDateTime_.[[Time]].[[Nanosecond]]).
get Temporal.ZonedDateTime.prototype.epochMilliseconds
`Temporal.ZonedDateTime.prototype.epochMilliseconds` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _ns_ be _zonedDateTime_.[[EpochNanoseconds]].
1. Let _ms_ be floor(ℝ(_ns_) / 106).
1. Return 𝔽(_ms_).
get Temporal.ZonedDateTime.prototype.epochNanoseconds
`Temporal.ZonedDateTime.prototype.epochNanoseconds` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Return _zonedDateTime_.[[EpochNanoseconds]].
get Temporal.ZonedDateTime.prototype.dayOfWeek
`Temporal.ZonedDateTime.prototype.dayOfWeek` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return 𝔽(CalendarISOToDate(_zonedDateTime_.[[Calendar]], _isoDateTime_.[[ISODate]]).[[DayOfWeek]]).
get Temporal.ZonedDateTime.prototype.dayOfYear
`Temporal.ZonedDateTime.prototype.dayOfYear` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return 𝔽(CalendarISOToDate(_zonedDateTime_.[[Calendar]], _isoDateTime_.[[ISODate]]).[[DayOfYear]]).
get Temporal.ZonedDateTime.prototype.weekOfYear
`Temporal.ZonedDateTime.prototype.weekOfYear` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Let _result_ be CalendarISOToDate(_zonedDateTime_.[[Calendar]], _isoDateTime_.[[ISODate]]).[[WeekOfYear]].[[Week]].
1. If _result_ is *undefined*, return *undefined*.
1. Return 𝔽(_result_).
get Temporal.ZonedDateTime.prototype.yearOfWeek
`Temporal.ZonedDateTime.prototype.yearOfWeek` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Let _result_ be CalendarISOToDate(_zonedDateTime_.[[Calendar]], _isoDateTime_.[[ISODate]]).[[WeekOfYear]].[[Year]].
1. If _result_ is *undefined*, return *undefined*.
1. Return 𝔽(_result_).
get Temporal.ZonedDateTime.prototype.hoursInDay
`Temporal.ZonedDateTime.prototype.hoursInDay` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _timeZone_ be _zonedDateTime_.[[TimeZone]].
1. Let _isoDateTime_ be GetISODateTimeFor(_timeZone_, _zonedDateTime_.[[EpochNanoseconds]]).
1. Let _today_ be _isoDateTime_.[[ISODate]].
1. Let _tomorrow_ be BalanceISODate(_today_.[[Year]], _today_.[[Month]], _today_.[[Day]] + 1).
1. Let _todayNs_ be ? GetStartOfDay(_timeZone_, _today_).
1. Let _tomorrowNs_ be ? GetStartOfDay(_timeZone_, _tomorrow_).
1. Let _diff_ be TimeDurationFromEpochNanosecondsDifference(_tomorrowNs_, _todayNs_).
1. Return 𝔽(TotalTimeDuration(_diff_, ~hour~)).
get Temporal.ZonedDateTime.prototype.daysInWeek
`Temporal.ZonedDateTime.prototype.daysInWeek` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return 𝔽(CalendarISOToDate(_zonedDateTime_.[[Calendar]], _isoDateTime_.[[ISODate]]).[[DaysInWeek]]).
get Temporal.ZonedDateTime.prototype.daysInMonth
`Temporal.ZonedDateTime.prototype.daysInMonth` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return 𝔽(CalendarISOToDate(_zonedDateTime_.[[Calendar]], _isoDateTime_.[[ISODate]]).[[DaysInMonth]]).
get Temporal.ZonedDateTime.prototype.daysInYear
`Temporal.ZonedDateTime.prototype.daysInYear` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return 𝔽(CalendarISOToDate(_zonedDateTime_.[[Calendar]], _isoDateTime_.[[ISODate]]).[[DaysInYear]]).
get Temporal.ZonedDateTime.prototype.monthsInYear
`Temporal.ZonedDateTime.prototype.monthsInYear` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return 𝔽(CalendarISOToDate(_zonedDateTime_.[[Calendar]], _isoDateTime_.[[ISODate]]).[[MonthsInYear]]).
get Temporal.ZonedDateTime.prototype.inLeapYear
`Temporal.ZonedDateTime.prototype.inLeapYear` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return CalendarISOToDate(_zonedDateTime_.[[Calendar]], _isoDateTime_.[[ISODate]]).[[InLeapYear]].
get Temporal.ZonedDateTime.prototype.offsetNanoseconds
`Temporal.ZonedDateTime.prototype.offsetNanoseconds` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Return 𝔽(GetOffsetNanosecondsFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]])).
get Temporal.ZonedDateTime.prototype.offset
`Temporal.ZonedDateTime.prototype.offset` is an accessor property whose set accessor function is *undefined*.
Its get accessor function performs the following steps:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _offsetNanoseconds_ be GetOffsetNanosecondsFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return FormatUTCOffsetNanoseconds(_offsetNanoseconds_).
Temporal.ZonedDateTime.prototype.with ( _temporalZonedDateTimeLike_ [ , _options_ ] )
This method performs the following steps when called:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. If ? IsPartialTemporalObject(_temporalZonedDateTimeLike_) is *false*, throw a *TypeError* exception.
1. Let _epochNs_ be _zonedDateTime_.[[EpochNanoseconds]].
1. Let _timeZone_ be _zonedDateTime_.[[TimeZone]].
1. Let _calendar_ be _zonedDateTime_.[[Calendar]].
1. Let _offsetNanoseconds_ be GetOffsetNanosecondsFor(_timeZone_, _epochNs_).
1. Let _isoDateTime_ be GetISODateTimeFor(_timeZone_, _epochNs_).
1. Let _fields_ be ISODateToFields(_calendar_, _isoDateTime_.[[ISODate]], ~date~).
1. Set _fields_.[[Hour]] to _isoDateTime_.[[Time]].[[Hour]].
1. Set _fields_.[[Minute]] to _isoDateTime_.[[Time]].[[Minute]].
1. Set _fields_.[[Second]] to _isoDateTime_.[[Time]].[[Second]].
1. Set _fields_.[[Millisecond]] to _isoDateTime_.[[Time]].[[Millisecond]].
1. Set _fields_.[[Microsecond]] to _isoDateTime_.[[Time]].[[Microsecond]].
1. Set _fields_.[[Nanosecond]] to _isoDateTime_.[[Time]].[[Nanosecond]].
1. Set _fields_.[[OffsetString]] to FormatUTCOffsetNanoseconds(_offsetNanoseconds_).
1. Let _partialZonedDateTime_ be ? PrepareCalendarFields(_calendar_, _temporalZonedDateTimeLike_, « ~year~, ~month~, ~month-code~, ~day~ », « ~hour~, ~minute~, ~second~, ~millisecond~, ~microsecond~, ~nanosecond~, ~offset~ », ~partial~).
1. Set _fields_ to CalendarMergeFields(_calendar_, _fields_, _partialZonedDateTime_).
1. Let _resolvedOptions_ be ? GetOptionsObject(_options_).
1. Let _disambiguation_ be ? GetTemporalDisambiguationOption(_resolvedOptions_).
1. Let _offset_ be ? GetTemporalOffsetOption(_resolvedOptions_, ~prefer~).
1. Let _overflow_ be ? GetTemporalOverflowOption(_resolvedOptions_).
1. Let _dateTimeResult_ be ? InterpretTemporalDateTimeFields(_calendar_, _fields_, _overflow_).
1. Let _newOffsetNanoseconds_ be ! ParseDateTimeUTCOffset(_fields_.[[OffsetString]]).
1. Let _epochNanoseconds_ be ? InterpretISODateTimeOffset(_dateTimeResult_.[[ISODate]], _dateTimeResult_.[[Time]], ~option~, _newOffsetNanoseconds_, _timeZone_, _disambiguation_, _offset_, ~match-exactly~).
1. Return ! CreateTemporalZonedDateTime(_epochNanoseconds_, _timeZone_, _calendar_).
Temporal.ZonedDateTime.prototype.withPlainTime ( [ _plainTimeLike_ ] )
This method performs the following steps when called:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _timeZone_ be _zonedDateTime_.[[TimeZone]].
1. Let _calendar_ be _zonedDateTime_.[[Calendar]].
1. Let _isoDateTime_ be GetISODateTimeFor(_timeZone_, _zonedDateTime_.[[EpochNanoseconds]]).
1. If _plainTimeLike_ is *undefined*, then
1. Let _epochNs_ be ? GetStartOfDay(_timeZone_, _isoDateTime_.[[ISODate]]).
1. Else,
1. Let _plainTime_ be ? ToTemporalTime(_plainTimeLike_).
1. Let _resultISODateTime_ be CombineISODateAndTimeRecord(_isoDateTime_.[[ISODate]], _plainTime_.[[Time]]).
1. Let _epochNs_ be ? GetEpochNanosecondsFor(_timeZone_, _resultISODateTime_, ~compatible~).
1. Return ! CreateTemporalZonedDateTime(_epochNs_, _timeZone_, _calendar_).
Temporal.ZonedDateTime.prototype.withTimeZone ( _timeZoneLike_ )
This method performs the following steps when called:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _timeZone_ be ? ToTemporalTimeZoneIdentifier(_timeZoneLike_).
1. Return ! CreateTemporalZonedDateTime(_zonedDateTime_.[[EpochNanoseconds]], _timeZone_, _zonedDateTime_.[[Calendar]]).
Temporal.ZonedDateTime.prototype.withCalendar ( _calendarLike_ )
This method performs the following steps when called:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _calendar_ be ? ToTemporalCalendarIdentifier(_calendarLike_).
1. Return ! CreateTemporalZonedDateTime(_zonedDateTime_.[[EpochNanoseconds]], _zonedDateTime_.[[TimeZone]], _calendar_).
Temporal.ZonedDateTime.prototype.add ( _temporalDurationLike_ [ , _options_ ] )
This method performs the following steps when called:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Return ? AddDurationToZonedDateTime(~add~, _zonedDateTime_, _temporalDurationLike_, _options_).
Temporal.ZonedDateTime.prototype.subtract ( _temporalDurationLike_ [ , _options_ ] )
This method performs the following steps when called:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Return ? AddDurationToZonedDateTime(~subtract~, _zonedDateTime_, _temporalDurationLike_, _options_).
Temporal.ZonedDateTime.prototype.until ( _other_ [ , _options_ ] )
This method performs the following steps when called:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Return ? DifferenceTemporalZonedDateTime(~until~, _zonedDateTime_, _other_, _options_).
Temporal.ZonedDateTime.prototype.since ( _other_ [ , _options_ ] )
This method performs the following steps when called:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Return ? DifferenceTemporalZonedDateTime(~since~, _zonedDateTime_, _other_, _options_).
Temporal.ZonedDateTime.prototype.round ( _roundTo_ )
This method performs the following steps when called:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. If _roundTo_ is *undefined*, then
1. Throw a *TypeError* exception.
1. If _roundTo_ is a String, then
1. Let _paramString_ be _roundTo_.
1. Set _roundTo_ to OrdinaryObjectCreate(*null*).
1. Perform ! CreateDataPropertyOrThrow(_roundTo_, *"smallestUnit"*, _paramString_).
1. Else,
1. Set _roundTo_ to ? GetOptionsObject(_roundTo_).
1. NOTE: The following steps read options and perform independent validation in alphabetical order (GetRoundingIncrementOption reads *"roundingIncrement"* and GetRoundingModeOption reads *"roundingMode"*).
1. Let _roundingIncrement_ be ? GetRoundingIncrementOption(_roundTo_).
1. Let _roundingMode_ be ? GetRoundingModeOption(_roundTo_, ~half-expand~).
1. Let _smallestUnit_ be ? GetTemporalUnitValuedOption(_roundTo_, *"smallestUnit"*, ~time~, ~required~, « ~day~ »).
1. If _smallestUnit_ is ~day~, then
1. Let _maximum_ be 1.
1. Let _inclusive_ be *true*.
1. Else,
1. Let _maximum_ be MaximumTemporalDurationRoundingIncrement(_smallestUnit_).
1. Assert: _maximum_ is not ~unset~.
1. Let _inclusive_ be *false*.
1. Perform ? ValidateTemporalRoundingIncrement(_roundingIncrement_, _maximum_, _inclusive_).
1. If _smallestUnit_ is ~nanosecond~ and _roundingIncrement_ = 1, then
1. Return ! CreateTemporalZonedDateTime(_zonedDateTime_.[[EpochNanoseconds]], _zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[Calendar]]).
1. Let _thisNs_ be _zonedDateTime_.[[EpochNanoseconds]].
1. Let _timeZone_ be _zonedDateTime_.[[TimeZone]].
1. Let _calendar_ be _zonedDateTime_.[[Calendar]].
1. Let _isoDateTime_ be GetISODateTimeFor(_timeZone_, _thisNs_).
1. If _smallestUnit_ is ~day~, then
1. Let _dateStart_ be _isoDateTime_.[[ISODate]].
1. Let _dateEnd_ be BalanceISODate(_dateStart_.[[Year]], _dateStart_.[[Month]], _dateStart_.[[Day]] + 1).
1. Let _startNs_ be ? GetStartOfDay(_timeZone_, _dateStart_).
1. Assert: _thisNs_ ≥ _startNs_.
1. Let _endNs_ be ? GetStartOfDay(_timeZone_, _dateEnd_).
1. Assert: _thisNs_ < _endNs_.
1. Let _dayLengthNs_ be ℝ(_endNs_ - _startNs_).
1. Let _dayProgressNs_ be TimeDurationFromEpochNanosecondsDifference(_thisNs_, _startNs_).
1. Let _roundedDayNs_ be ! RoundTimeDurationToIncrement(_dayProgressNs_, _dayLengthNs_, _roundingMode_).
1. Let _epochNanoseconds_ be AddTimeDurationToEpochNanoseconds(_roundedDayNs_, _startNs_).
1. Else,
1. Let _roundResult_ be RoundISODateTime(_isoDateTime_, _roundingIncrement_, _smallestUnit_, _roundingMode_).
1. Let _offsetNanoseconds_ be GetOffsetNanosecondsFor(_timeZone_, _thisNs_).
1. Let _epochNanoseconds_ be ? InterpretISODateTimeOffset(_roundResult_.[[ISODate]], _roundResult_.[[Time]], ~option~, _offsetNanoseconds_, _timeZone_, ~compatible~, ~prefer~, ~match-exactly~).
1. Return ! CreateTemporalZonedDateTime(_epochNanoseconds_, _timeZone_, _calendar_).
Temporal.ZonedDateTime.prototype.equals ( _other_ )
This method performs the following steps when called:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Set _other_ to ? ToTemporalZonedDateTime(_other_).
1. If _zonedDateTime_.[[EpochNanoseconds]] ≠ _other_.[[EpochNanoseconds]], return *false*.
1. If TimeZoneEquals(_zonedDateTime_.[[TimeZone]], _other_.[[TimeZone]]) is *false*, return *false*.
1. Return CalendarEquals(_zonedDateTime_.[[Calendar]], _other_.[[Calendar]]).
Temporal.ZonedDateTime.prototype.toString ( [ _options_ ] )
This method performs the following steps when called:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _resolvedOptions_ be ? GetOptionsObject(_options_).
1. NOTE: The following steps read options and perform independent validation in alphabetical order (GetTemporalShowCalendarNameOption reads *"calendarName"*, GetTemporalFractionalSecondDigitsOption reads *"fractionalSecondDigits"*, GetTemporalShowOffsetOption reads *"offset"*, and GetRoundingModeOption reads *"roundingMode"*).
1. Let _showCalendar_ be ? GetTemporalShowCalendarNameOption(_resolvedOptions_).
1. Let _digits_ be ? GetTemporalFractionalSecondDigitsOption(_resolvedOptions_).
1. Let _showOffset_ be ? GetTemporalShowOffsetOption(_resolvedOptions_).
1. Let _roundingMode_ be ? GetRoundingModeOption(_resolvedOptions_, ~trunc~).
1. Let _smallestUnit_ be ? GetTemporalUnitValuedOption(_resolvedOptions_, *"smallestUnit"*, ~time~, ~unset~).
1. If _smallestUnit_ is ~hour~, throw a *RangeError* exception.
1. Let _showTimeZone_ be ? GetTemporalShowTimeZoneNameOption(_resolvedOptions_).
1. Let _precision_ be ToSecondsStringPrecisionRecord(_smallestUnit_, _digits_).
1. Return TemporalZonedDateTimeToString(_zonedDateTime_, _precision_.[[Precision]], _showCalendar_, _showTimeZone_, _showOffset_, _precision_.[[Increment]], _precision_.[[Unit]], _roundingMode_).
Temporal.ZonedDateTime.prototype.toLocaleString ( [ _locales_ [ , _options_ ] ] )
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement this method as specified in the ECMA-402 specification.
If an ECMAScript implementation does not include the ECMA-402 API the following specification of this method is used.
The meanings of the optional parameters to this method are defined in the ECMA-402 specification; implementations that do not include ECMA-402 support must not use those parameter positions for anything else.
This method performs the following steps when called:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Return TemporalZonedDateTimeToString(_zonedDateTime_, ~auto~, ~auto~, ~auto~, ~auto~).
Temporal.ZonedDateTime.prototype.toJSON ( )
This method performs the following steps when called:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Return TemporalZonedDateTimeToString(_zonedDateTime_, ~auto~, ~auto~, ~auto~, ~auto~).
Temporal.ZonedDateTime.prototype.valueOf ( )
This method performs the following steps when called:
1. Throw a *TypeError* exception.
This method always throws, because in the absence of `valueOf()`, expressions with arithmetic operators such as `zonedDateTime1 > zonedDateTime2` would fall back to being equivalent to `zonedDateTime1.toString() > zonedDateTime2.toString()`.
Lexicographical comparison of serialized strings might not seem obviously wrong, because the result would sometimes be correct.
Implementations are encouraged to phrase the error message to point users to `Temporal.ZonedDateTime.compare()`, `Temporal.ZonedDateTime.prototype.equals()`, and/or `Temporal.ZonedDateTime.prototype.toString()`.
Temporal.ZonedDateTime.prototype.startOfDay ( )
This method performs the following steps when called:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _timeZone_ be _zonedDateTime_.[[TimeZone]].
1. Let _calendar_ be _zonedDateTime_.[[Calendar]].
1. Let _isoDateTime_ be GetISODateTimeFor(_timeZone_, _zonedDateTime_.[[EpochNanoseconds]]).
1. Let _epochNanoseconds_ be ? GetStartOfDay(_timeZone_, _isoDateTime_.[[ISODate]]).
1. Return ! CreateTemporalZonedDateTime(_epochNanoseconds_, _timeZone_, _calendar_).
Temporal.ZonedDateTime.prototype.getTimeZoneTransition ( _directionParam_ )
This method performs the following steps when called:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _timeZone_ be _zonedDateTime_.[[TimeZone]].
1. If _directionParam_ is *undefined*, throw a *TypeError* exception.
1. If _directionParam_ is a String, then
1. Let _paramString_ be _directionParam_.
1. Set _directionParam_ to OrdinaryObjectCreate(*null*).
1. Perform ! CreateDataPropertyOrThrow(_directionParam_, *"direction"*, _paramString_).
1. Else,
1. Set _directionParam_ to ? GetOptionsObject(_directionParam_).
1. Let _direction_ be ? GetDirectionOption(_directionParam_).
1. If IsOffsetTimeZoneIdentifier(_timeZone_) is *true*, return *null*.
1. If _direction_ is ~next~, then
1. Let _transition_ be GetNamedTimeZoneNextTransition(_timeZone_, _zonedDateTime_.[[EpochNanoseconds]]).
1. Else,
1. Assert: _direction_ is ~previous~.
1. Let _transition_ be GetNamedTimeZonePreviousTransition(_timeZone_, _zonedDateTime_.[[EpochNanoseconds]]).
1. If _transition_ is *null*, return *null*.
1. Return ! CreateTemporalZonedDateTime(_transition_, _timeZone_, _zonedDateTime_.[[Calendar]]).
Temporal.ZonedDateTime.prototype.toInstant ( )
This method performs the following steps when called:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Return ! CreateTemporalInstant(_zonedDateTime_.[[EpochNanoseconds]]).
Temporal.ZonedDateTime.prototype.toPlainDate ( )
This method performs the following steps when called:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return ! CreateTemporalDate(_isoDateTime_.[[ISODate]], _zonedDateTime_.[[Calendar]]).
Temporal.ZonedDateTime.prototype.toPlainTime ( )
This method performs the following steps when called:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return ! CreateTemporalTime(_isoDateTime_.[[Time]]).
Temporal.ZonedDateTime.prototype.toPlainDateTime ( )
This method performs the following steps when called:
1. Let _zonedDateTime_ be the *this* value.
1. Perform ? RequireInternalSlot(_zonedDateTime_, [[InitializedTemporalZonedDateTime]]).
1. Let _isoDateTime_ be GetISODateTimeFor(_zonedDateTime_.[[TimeZone]], _zonedDateTime_.[[EpochNanoseconds]]).
1. Return ! CreateTemporalDateTime(_isoDateTime_, _zonedDateTime_.[[Calendar]]).