?
u
/
p
1-9
The venerable ECMAScript Date object has a number of challenges, including lack of immutability, lack of support for time zones, lack of support for use cases that require dates only or times only, a confusing and non-ergonomic API, and many other challenges.
The Temporal set of types addresses these challenges with a built-in date and time API for ECMAScript that includes:
This specification consists of three parts:
The Temporal object:
new
operator.The initial value of the
This property has the attributes { [[Writable]]:
See
See
See
See
See
See
See
See
See
See
See
The Temporal.Now object:
new
operator.The initial value of the
This property has the attributes { [[Writable]]:
This function performs the following steps when called:
This function performs the following steps when called:
This function performs the following steps when called:
This function performs the following steps when called:
This function performs the following steps when called:
This function performs the following steps when called:
This function performs the following steps when called:
This function performs the following steps when called:
This function performs the following steps when called:
The
An implementation of HostSystemUTCEpochNanoseconds must conform to the following requirements:
This requirement is necessary if the system clock is set to a time outside the range that Temporal.Instant can represent. This is not expected to affect implementations in practice.
The default implementation of HostSystemUTCEpochNanoseconds performs the following steps when called:
ECMAScript
A Temporal.PlainDate object
The Temporal.PlainDate
extends
clause of a class definition.
Subclass This function performs the following steps when called:
The Temporal.PlainDate
The initial value of Temporal.PlainDate.prototype
is %Temporal.PlainDate.prototype%.
This property has the attributes { [[Writable]]:
This function performs the following steps when called:
This function performs the following steps when called:
The Temporal.PlainDate prototype object
The initial value of Temporal.PlainDate.prototype.constructor
is %Temporal.PlainDate%.
The initial value of the
This property has the attributes { [[Writable]]:
Temporal.PlainDate.prototype.calendarId
is an
Temporal.PlainDate.prototype.year
is an
Temporal.PlainDate.prototype.month
is an
Temporal.PlainDate.prototype.monthCode
is an
Temporal.PlainDate.prototype.day
is an
Temporal.PlainDate.prototype.dayOfWeek
is an
Temporal.PlainDate.prototype.dayOfYear
is an
Temporal.PlainDate.prototype.weekOfYear
is an
Temporal.PlainDate.prototype.yearOfWeek
is an
Temporal.PlainDate.prototype.daysInWeek
is an
Temporal.PlainDate.prototype.daysInMonth
is an
Temporal.PlainDate.prototype.daysInYear
is an
Temporal.PlainDate.prototype.monthsInYear
is an
Temporal.PlainDate.prototype.inLeapYear
is an
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
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:
This method performs the following steps when called:
This method performs the following steps when called:
Temporal.PlainDate instances are
Internal Slot | Description |
---|---|
[[InitializedTemporalDate]] | The only specified use of this slot is for distinguishing Temporal.PlainDate instances from other objects. |
[[ISOYear]] |
An |
[[ISOMonth]] |
An |
[[ISODay]] |
An |
[[Calendar]] | A String or Object representing the calendar. |
An ISO Date Record is a
ISO Date Records have the fields listed in
Field Name | Value | Meaning |
---|---|---|
[[Year]] | an |
The year in the ISO 8601 calendar. |
[[Month]] | an |
The number of the month in the ISO 8601 calendar. |
[[Day]] | an |
The number of the day of the month in the ISO 8601 calendar. |
The abstract operation CreateISODateRecord takes arguments year (an
The abstract operation CreateTemporalDate takes arguments isoYear (an
Deferring to
The abstract operation ToTemporalDate takes argument item (an
The abstract operation ISODateSurpasses takes arguments sign (-1 or 1), y1 (an
The abstract operation DifferenceISODate takes arguments y1 (an
The abstract operation DifferenceDate takes arguments calendarRec (a dateUntil
method of the given calendar as in
The abstract operation RegulateISODate takes arguments year (an
The abstract operation IsValidISODate takes arguments year (an
The abstract operation BalanceISODate takes arguments year (an
The abstract operation AddDate takes arguments calendarRec (a dateAdd
method of the given calendar as in
The abstract operation DifferenceTemporalPlainDate takes arguments operation (
A Temporal.PlainTime object
The Temporal.PlainTime
extends
clause of a class definition.
Subclass This function performs the following steps when called:
The value of the [[Prototype]] internal slot of the Temporal.PlainTime
The Temporal.PlainTime
The initial value of Temporal.PlainTime.prototype
is %Temporal.PlainTime.prototype%.
This property has the attributes { [[Writable]]:
This function performs the following steps when called:
This function performs the following steps when called:
The Temporal.PlainTime prototype object
The initial value of Temporal.PlainTime.prototype.constructor
is %Temporal.PlainTime%.
The initial value of the
This property has the attributes { [[Writable]]:
Temporal.PlainTime.prototype.hour
is an
Temporal.PlainTime.prototype.minute
is an
Temporal.PlainTime.prototype.second
is an
Temporal.PlainTime.prototype.millisecond
is an
Temporal.PlainTime.prototype.microsecond
is an
Temporal.PlainTime.prototype.nanosecond
is an
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
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:
This method performs the following steps when called:
This method performs the following steps when called:
Temporal.PlainTime instances are
Internal Slot | Description |
---|---|
[[InitializedTemporalTime]] | The only specified use of this slot is for distinguishing Temporal.PlainTime instances from other objects. |
[[ISOHour]] |
An |
[[ISOMinute]] |
An |
[[ISOSecond]] |
An |
[[ISOMillisecond]] |
An |
[[ISOMicrosecond]] |
An |
[[ISONanosecond]] |
An |
A Time Record is a
Time Records have the fields listed in
Field Name | Value | Meaning |
---|---|---|
[[Days]] | an |
A number of overflow days. |
[[Hour]] | an |
The number of the hour. |
[[Minute]] | an |
The number of the minute. |
[[Second]] | an |
The number of the second. |
[[Millisecond]] | an |
The number of the millisecond. |
[[Microsecond]] | an |
The number of the microsecond. |
[[Nanosecond]] | an |
The number of the nanosecond. |
The abstract operation DifferenceTime takes arguments h1 (an
The abstract operation ToTemporalTime returns its argument item if it is already a Temporal.PlainTime instance, converts item to a new Temporal.PlainTime instance if possible, and throws otherwise.
The abstract operation IsValidTime takes arguments hour (an
The abstract operation BalanceTime takes arguments hour (an
The abstract operation CreateTemporalTime takes arguments hour (an
The abstract operation ToTemporalTimeRecord takes argument temporalTimeLike (an Object) and optional argument completeness (
Field Name | Property Name |
---|---|
[[Hour]] | |
[[Minute]] | |
[[Second]] | |
[[Millisecond]] | |
[[Microsecond]] | |
[[Nanosecond]] |
The abstract operation AddTime takes arguments hour (an
The abstract operation RoundTime takes arguments hour (an
The abstract operation DifferenceTemporalPlainTime takes arguments operation (
The abstract operation AddDurationToOrSubtractDurationFromPlainTime takes arguments operation (
A Temporal.PlainDateTime object
The Temporal.PlainDateTime
extends
clause of a class definition.
Subclass This function performs the following steps when called:
The value of the [[Prototype]] internal slot of the Temporal.PlainDateTime
The Temporal.PlainDateTime
The initial value of Temporal.PlainDateTime.prototype
is
This property has the attributes { [[Writable]]:
This function performs the following steps when called:
This function performs the following steps when called:
The Temporal.PlainDateTime prototype object
The initial value of Temporal.PlainDateTime.prototype.constructor
is %Temporal.PlainDateTime%.
The initial value of the
This property has the attributes { [[Writable]]:
Temporal.PlainDateTime.prototype.calendarId
is an
Temporal.PlainDateTime.prototype.year
is an
Temporal.PlainDateTime.prototype.month
is an
Temporal.PlainDateTime.prototype.monthCode
is an
Temporal.PlainDateTime.prototype.day
is an
Temporal.PlainDateTime.prototype.hour
is an
Temporal.PlainDateTime.prototype.minute
is an
Temporal.PlainDateTime.prototype.second
is an
Temporal.PlainDateTime.prototype.millisecond
is an
Temporal.PlainDateTime.prototype.microsecond
is an
Temporal.PlainDateTime.prototype.nanosecond
is an
Temporal.PlainDateTime.prototype.dayOfWeek
is an
Temporal.PlainDateTime.prototype.dayOfYear
is an
Temporal.PlainDateTime.prototype.weekOfYear
is an
Temporal.PlainDateTime.prototype.yearOfWeek
is an
Temporal.PlainDateTime.prototype.daysInWeek
is an
Temporal.PlainDateTime.prototype.daysInMonth
is an
Temporal.PlainDateTime.prototype.daysInYear
is an
Temporal.PlainDateTime.prototype.monthsInYear
is an
Temporal.PlainDateTime.prototype.inLeapYear
is an
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
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:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
Temporal.PlainDateTime instances are
Internal Slot | Description |
---|---|
[[InitializedTemporalDateTime]] | The only specified use of this slot is for distinguishing Temporal.PlainDateTime instances from other objects. |
[[ISOYear]] |
An |
[[ISOMonth]] |
An |
[[ISODay]] |
An |
[[ISOHour]] |
An |
[[ISOMinute]] |
An |
[[ISOSecond]] |
An |
[[ISOMillisecond]] |
An |
[[ISOMicrosecond]] |
An |
[[ISONanosecond]] |
An |
[[Calendar]] | A String or Object representing the calendar. |
An ISO Date-Time Record is a
ISO Date-Time Records have the fields listed in
Field Name | Value | Meaning |
---|---|---|
[[Year]] | an |
The year in the ISO 8601 calendar. |
[[Month]] | an |
The number of the month in the ISO 8601 calendar. |
[[Day]] | an |
The number of the day of the month in the ISO 8601 calendar. |
[[Hour]] | an |
The number of the hour. |
[[Minute]] | an |
The number of the minute. |
[[Second]] | an |
The number of the second. |
[[Millisecond]] | an |
The number of the millisecond. |
[[Microsecond]] | an |
The number of the microsecond. |
[[Nanosecond]] | an |
The number of the nanosecond. |
The abstract operation ISODateTimeWithinLimits takes arguments year (an Temporal.PlainDateTime
, and
Temporal.PlainDateTime objects can represent points in time within 24 hours (8.64 × 1013 nanoseconds) of the Temporal.Instant boundaries. This ensures that a Temporal.Instant object can be converted into a Temporal.PlainDateTime object using any time zone.
It performs the following steps when called:
The abstract operation InterpretTemporalDateTimeFields takes arguments calendarRec (a
The abstract operation ToTemporalDateTime takes argument item (an
The abstract operation BalanceISODateTime takes arguments year (an
The abstract operation CreateTemporalDateTime takes arguments isoYear (an
The abstract operation AddDateTime takes arguments year (an
The abstract operation RoundISODateTime takes arguments year (an
The abstract operation DifferenceISODateTime takes arguments y1 (an dateUntil
method.
It performs the following steps when called:
The abstract operation DifferenceTemporalPlainDateTime takes arguments operation (
The abstract operation AddDurationToOrSubtractDurationFromPlainDateTime takes arguments operation (
A Temporal.ZonedDateTime object
The Temporal.ZonedDateTime
extends
clause of a class definition.
Subclass This function performs the following steps when called:
The value of the [[Prototype]] internal slot of the Temporal.ZonedDateTime
The Temporal.ZonedDateTime
The initial value of Temporal.ZonedDateTime.prototype
is %Temporal.ZonedDateTime.prototype%.
This property has the attributes { [[Writable]]:
This function performs the following steps when called:
This function performs the following steps when called:
The Temporal.ZonedDateTime prototype object
The initial value of Temporal.ZonedDateTime.prototype.constructor
is %Temporal.ZonedDateTime%.
The initial value of the
This property has the attributes { [[Writable]]:
Temporal.ZonedDateTime.prototype.calendarId
is an
Temporal.ZonedDateTime.prototype.timeZoneId
is an
Temporal.ZonedDateTime.prototype.year
is an
Temporal.ZonedDateTime.prototype.month
is an
Temporal.ZonedDateTime.prototype.monthCode
is an
Temporal.ZonedDateTime.prototype.day
is an
Temporal.ZonedDateTime.prototype.hour
is an
Temporal.ZonedDateTime.prototype.minute
is an
Temporal.ZonedDateTime.prototype.second
is an
Temporal.ZonedDateTime.prototype.millisecond
is an
Temporal.ZonedDateTime.prototype.microsecond
is an
Temporal.ZonedDateTime.prototype.nanosecond
is an
Temporal.ZonedDateTime.prototype.epochSeconds
is an
Temporal.ZonedDateTime.prototype.epochMilliseconds
is an
Temporal.ZonedDateTime.prototype.epochMicroseconds
is an
Temporal.ZonedDateTime.prototype.epochNanoseconds
is an
Temporal.ZonedDateTime.prototype.dayOfWeek
is an
Temporal.ZonedDateTime.prototype.dayOfYear
is an
Temporal.ZonedDateTime.prototype.weekOfYear
is an
Temporal.ZonedDateTime.prototype.yearOfWeek
is an
Temporal.ZonedDateTime.prototype.hoursInDay
is an
Temporal.ZonedDateTime.prototype.daysInWeek
is an
Temporal.ZonedDateTime.prototype.daysInMonth
is an
Temporal.ZonedDateTime.prototype.daysInYear
is an
Temporal.ZonedDateTime.prototype.monthsInYear
is an
Temporal.ZonedDateTime.prototype.inLeapYear
is an
Temporal.ZonedDateTime.prototype.offsetNanoseconds
is an
Temporal.ZonedDateTime.prototype.offset
is an
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
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:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
Temporal.ZonedDateTime instances are
Internal Slot | Description |
---|---|
[[InitializedTemporalZonedDateTime]] | The only specified use of this slot is for distinguishing Temporal.ZonedDateTime instances from other objects. |
[[Nanoseconds]] |
A BigInt value representing the number of nanoseconds since the |
[[TimeZone]] | A String or Object representing the time zone. |
[[Calendar]] | A String or Object representing the calendar. |
The abstract operation InterpretISODateTimeOffset takes arguments year (an
It determines the exact time in timeZone corresponding to the given calendar date and time, and the given UTC offset in nanoseconds. In the case of more than one possible exact time, or no possible exact time, an answer is determined using offsetBehaviour, disambiguation and offsetOption.
As a special case when parsing ISO 8601 strings which are only required to specify time zone offsets to minutes precision, if matchBehaviour is
It performs the following steps when called:
The abstract operation ToTemporalZonedDateTime takes argument item (an
The abstract operation CreateTemporalZonedDateTime takes arguments epochNanoseconds (a BigInt), timeZone (a String or Object), and calendar (a String or Object) and optional argument newTarget (a
The abstract operation TemporalZonedDateTimeToString takes arguments zonedDateTime (a Temporal.ZonedDateTime), precision (one of
The abstract operation AddZonedDateTime takes arguments epochNanoseconds (a BigInt), timeZoneRec (a
Unless precalculatedPlainDateTime is supplied, the given timeZone's getOffsetNanosecondsFor
method will be called to convert epochNanoseconds to a wall-clock time, and timeZoneRec must have looked up getOffsetNanosecondsFor
. getPossibleInstantsFor
will always be called and must have been looked up.
The abstract operation AddDaysToZonedDateTime takes arguments instant (a Temporal.Instant), dateTime (a Temporal.PlainDateTime), timeZoneRec (a
This operation is similar to
The abstract operation DifferenceZonedDateTime takes arguments ns1 (a BigInt), ns2 (a BigInt), timeZoneRec (a
Unless ns1 and ns2 are equal, timeZoneRec must have looked up both getOffsetNanosecondsFor
and getPossibleInstantsFor
.
The abstract operation NormalizedTimeDurationToDays takes arguments norm (a
Unless nanoseconds = 0, timeZoneRec must have looked up both getOffsetNanosecondsFor
and getPossibleInstantsFor
.
The abstract operation DifferenceTemporalZonedDateTime takes arguments operation (
The abstract operation AddDurationToOrSubtractDurationFromZonedDateTime takes arguments operation (
A Temporal.Duration object describes the difference in elapsed time between two other Temporal objects of the same type: Instant, PlainDate, PlainDateTime, PlainTime, PlainYearMonth, or ZonedDateTime. Objects of this type are only created via the .since() and .until() methods of these objects.
The Temporal.Duration
extends
clause of a class definition.
Subclass
The Temporal.Duration
function performs the following steps when called:
The value of the [[Prototype]] internal slot of the Temporal.Duration
The Temporal.Duration
The initial value of Temporal.Duration.prototype
is
%Temporal.Duration.prototype%.
This property has the attributes { [[Writable]]:
The Temporal.Duration.from
function performs the following steps when called:
The Temporal.Duration.compare
function performs the following steps when called:
The Temporal.Duration prototype object
The initial value of Temporal.Duration.prototype.constructor
is %Temporal.Duration%.
The initial value of the
This property has the attributes { [[Writable]]:
Temporal.Duration.prototype.years
is an
Temporal.Duration.prototype.months
is an
Temporal.Duration.prototype.weeks
is an
Temporal.Duration.prototype.days
is an
Temporal.Duration.prototype.hours
is an
Temporal.Duration.prototype.minutes
is an
Temporal.Duration.prototype.seconds
is an
Temporal.Duration.prototype.milliseconds
is an
Temporal.Duration.prototype.microseconds
is an
Temporal.Duration.prototype.nanoseconds
is an
Temporal.Duration.prototype.sign
is an
Temporal.Duration.prototype.blank
is an
The Temporal.Duration.prototype.with
method performs the following steps when called:
The Temporal.Duration.prototype.negated
method performs the following steps when called:
The Temporal.Duration.prototype.abs
method performs the following steps when called:
The Temporal.Duration.prototype.add
method performs the following steps when called:
The Temporal.Duration.prototype.subtract
method performs the following steps when called:
The Temporal.Duration.prototype.round
method performs the following steps when called:
Temporal.PlainDateTime
or Temporal.PlainDate
for zonedRelativeTo will be used in one of the operations below.
The Temporal.Duration.prototype.total
method performs the following steps when called:
Temporal.PlainDateTime
or Temporal.PlainDate
for zonedRelativeTo will be used in one of the operations below.
The Temporal.Duration.prototype.toString
method performs the following steps when called:
The Temporal.Duration.prototype.toJSON
method performs the following steps when called:
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the Temporal.Duration.prototype.toLocaleString
method as specified in the ECMA-402 specification.
If an ECMAScript implementation does not include the ECMA-402 API the following specification of the Temporal.Duration.prototype.toLocaleString
method is used.
The Temporal.Duration.prototype.toLocaleString
method performs the following steps when called:
The Temporal.Duration.prototype.valueOf
method performs the following steps when called:
Temporal.Duration instances are
A float64-representable integer is an
Internal Slot | Description |
---|---|
[[InitializedTemporalDuration]] | The only specified use of this slot is for distinguishing Temporal.Duration instances from other objects. |
[[Years]] |
A |
[[Months]] |
A |
[[Weeks]] |
A |
[[Days]] |
A |
[[Hours]] |
A |
[[Minutes]] |
A |
[[Seconds]] |
A |
[[Milliseconds]] |
A |
[[Microseconds]] |
A |
[[Nanoseconds]] |
A |
A Duration Record is a
Duration Records have the fields listed in
Field Name | Property Name | Value | Meaning |
---|---|---|---|
[[Years]] | a |
The number of years in the duration. | |
[[Months]] | a |
The number of months in the duration. | |
[[Weeks]] | a |
The number of weeks in the duration. | |
[[Days]] | a |
The number of days in the duration. | |
[[Hours]] | a |
The number of hours in the duration. | |
[[Minutes]] | a |
The number of minutes in the duration. | |
[[Seconds]] | a |
The number of seconds in the duration. | |
[[Milliseconds]] | a |
The number of milliseconds in the duration. | |
[[Microseconds]] | a |
The number of microseconds in the duration. | |
[[Nanoseconds]] | a |
The number of nanoseconds in the duration. |
A Date Duration Record is a
Of the fields listed in
A Time Duration Record is a
Of the fields listed in
A partial Duration Record is a
Partial Duration Records have the same fields listed in
A Normalized Time Duration Record is a
Normalized Time Duration Records have the fields listed in
Field Name | Value | Meaning |
---|---|---|
[[TotalNanoseconds]] |
an |
The number of nanoseconds in the duration. |
A Normalized Duration Record is a
Normalized Duration Records have the fields listed in
Field Name | Value | Meaning |
---|---|---|
[[Years]] | a |
The number of years in the duration. |
[[Months]] | a |
The number of months in the duration. |
[[Weeks]] | a |
The number of weeks in the duration. |
[[Days]] | a |
The number of days in the duration. |
[[NormalizedTime]] | a |
The time portion of the duration. |
The abstract operation CreateDurationRecord takes arguments years (an
The abstract operation CreateDateDurationRecord takes arguments years (an
The abstract operation CreateTimeDurationRecord takes arguments days (an
The abstract operation CreateNormalizedDurationRecord takes arguments years (an
The abstract operation CombineDateAndNormalizedTimeDuration takes arguments dateDurationRecord (a
The abstract operation ToTemporalDuration takes argument item (an
The abstract operation ToTemporalDurationRecord takes argument temporalDurationLike (an
The abstract operation DurationSign takes arguments years (an
The abstract operation IsValidDuration takes arguments years (an Temporal.Duration
, and
std::remquo()
with sufficient bits in the quotient. String manipulation will also give an exact result, since the multiplication is by a power of 10.The abstract operation DefaultTemporalLargestUnit takes arguments years (an Temporal.Duration.prototype.round()
method and elsewhere, where the largestUnit
option, if not given explicitly, is set to the largest non-zero unit in the input Temporal.Duration. It performs the following steps when called:
The abstract operation ToTemporalPartialDurationRecord takes argument temporalDurationLike (an
The abstract operation CreateTemporalDuration takes arguments years (an
The abstract operation CreateNegatedTemporalDuration takes argument duration (a Temporal.Duration). It returns a new Temporal.Duration instance that is the negation of duration. It performs the following steps when called:
The abstract operation NormalizeTimeDuration takes arguments hours (an
The abstract operation NormalizedTimeDurationAbs takes argument d (a
The abstract operation AddNormalizedTimeDuration takes arguments one (a
The abstract operation Add24HourDaysToNormalizedTimeDuration takes arguments d (a
The abstract operation AddNormalizedTimeDurationToEpochNanoseconds takes arguments d (a
The abstract operation CompareNormalizedTimeDuration takes arguments one (a
The abstract operation DivideNormalizedTimeDuration takes arguments d (a
__float128
type if the compiler supports it, or with software emulation such as in the SoftFP library.The abstract operation NormalizedTimeDurationFromEpochNanosecondsDifference takes arguments one (a BigInt) and two (a BigInt) and returns a
The abstract operation NormalizedTimeDurationIsZero takes argument d (a
The abstract operation RoundNormalizedTimeDurationToIncrement takes arguments d (a
The abstract operation NormalizedTimeDurationSeconds takes argument d (a
The abstract operation NormalizedTimeDurationSign takes argument d (a
The abstract operation NormalizedTimeDurationSubseconds takes argument d (a
The abstract operation SubtractNormalizedTimeDuration takes arguments one (a
The abstract operation ZeroTimeDuration takes no arguments and returns a
The abstract operation BalanceTimeDuration takes arguments norm (a
std::fma()
. String manipulation will also give an exact result, since the multiplication is by a power of 10.The abstract operation BalanceTimeDurationRelative takes arguments days (an
This operation observably calls time zone and calendar methods.
The abstract operation UnbalanceDateDurationRelative takes arguments years (an
The abstract operation BalanceDateDurationRelative takes arguments years (an
The abstract operation AddDuration takes arguments y1 (an
The abstract operation DaysUntil takes arguments earlier (a Temporal.PlainDate) and later (a Temporal.PlainDate) and returns an
The abstract operation MoveRelativeDate takes arguments calendarRec (a
The abstract operation MoveRelativeZonedDateTime takes arguments zonedDateTime (a Temporal.ZonedDateTime), calendarRec (a Temporal.ZonedDateTime
instance. It performs the following steps when called:
The abstract operation RoundDuration takes arguments years (an Temporal.Duration.prototype.total
.
For rounding involving calendar units, the relativeTo parameter is required.
It performs the following steps when called:
The abstract operation AdjustRoundedDurationDays takes arguments years (an
The abstract operation TemporalDurationToString takes arguments years (an
The abstract operation AddDurationToOrSubtractDurationFromDuration takes arguments operation (
A Temporal.Instant object
The Temporal.Instant
extends
clause of a class definition.
Subclass This function performs the following steps when called:
The value of the [[Prototype]] internal slot of the Temporal.Instant
The Temporal.Instant
The initial value of Temporal.Instant.prototype
is %Temporal.Instant.prototype%.
This property has the attributes { [[Writable]]:
This function performs the following steps when called:
This function performs the following steps when called:
This function performs the following steps when called:
This function performs the following steps when called:
This function performs the following steps when called:
This function performs the following steps when called:
The Temporal.Instant prototype object
The initial value of Temporal.Instant.prototype.constructor
is %Temporal.Instant%.
The initial value of the
This property has the attributes { [[Writable]]:
Temporal.Instant.prototype.epochSeconds
is an
Temporal.Instant.prototype.epochMilliseconds
is an
Temporal.Instant.prototype.epochMicroseconds
is an
Temporal.Instant.prototype.epochNanoseconds
is an
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
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:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
Temporal.Instant instances are
Internal Slot | Description |
---|---|
[[InitializedTemporalInstant]] | The only specified use of this slot is for distinguishing Temporal.Instant instances from other objects. |
[[Nanoseconds]] |
A BigInt value representing the number of nanoseconds since the |
The [[Nanoseconds]] internal slot of a Temporal.Instant object supports a range of exactly -100,000,000 to 100,000,000 days relative to midnight at the beginning of 1 January 1970 UTC, as in
The exact moment of midnight at the beginning of 1 January 1970 UTC is represented by the value
The maximum value is
where the number of nanoseconds per day is
The minimum value is
The abstract operation IsValidEpochNanoseconds returns
The abstract operation CreateTemporalInstant takes argument epochNanoseconds (a BigInt) and optional argument newTarget (a
The abstract operation ToTemporalInstant returns its argument item if it is already a Temporal.Instant instance, converts item to a new Temporal.Instant instance if possible, and throws otherwise.
The abstract operation CompareEpochNanoseconds takes arguments epochNanosecondsOne (a BigInt) and epochNanosecondsTwo (a BigInt) and returns either -1, 0, or 1. It performs the following steps when called:
The abstract operation AddInstant takes arguments epochNanoseconds (a BigInt value) and norm (a
The abstract operation DifferenceInstant takes arguments ns1 (a BigInt), ns2 (a BigInt), roundingIncrement (a positive
The abstract operation RoundTemporalInstant takes arguments ns (a BigInt), increment (a positive
The abstract operation DifferenceTemporalInstant takes arguments operation (
The abstract operation AddDurationToOrSubtractDurationFromInstant takes arguments operation (
A Temporal.PlainYearMonth object
The Temporal.PlainYearMonth
extends
clause of a class definition.
Subclass This function performs the following steps when called:
The value of the [[Prototype]] internal slot of the Temporal.PlainYearMonth
The Temporal.PlainYearMonth
The initial value of Temporal.PlainYearMonth.prototype
is %Temporal.PlainYearMonth.prototype%.
This property has the attributes { [[Writable]]:
This function performs the following steps when called:
This function performs the following steps when called:
The Temporal.PlainYearMonth prototype object
The initial value of Temporal.PlainYearMonth.prototype.constructor
is %Temporal.PlainYearMonth%.
The initial value of the
This property has the attributes { [[Writable]]:
Temporal.PlainYearMonth.prototype.calendarId
is an
Temporal.PlainYearMonth.prototype.year
is an
Temporal.PlainYearMonth.prototype.month
is an
Temporal.PlainYearMonth.prototype.monthCode
is an
Temporal.PlainYearMonth.prototype.daysInYear
is an
Temporal.PlainYearMonth.prototype.daysInMonth
is an
Temporal.PlainYearMonth.prototype.monthsInYear
is an
Temporal.PlainYearMonth.prototype.inLeapYear
is an
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
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:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
Temporal.PlainYearMonth instances are
Internal Slot | Description |
---|---|
[[InitializedTemporalYearMonth]] | The only specified use of this slot is for distinguishing Temporal.PlainYearMonth instances from other objects. |
[[ISOYear]] |
An |
[[ISOMonth]] |
An |
[[ISODay]] |
An |
[[Calendar]] | A String or Object representing the calendar. |
The abstract operation ToTemporalYearMonth takes argument item (an
The abstract operation ISOYearMonthWithinLimits returns
Temporal.PlainYearMonth objects can represent any month that contains a day that a Temporal.PlainDate can represent. This ensures that a Temporal.PlainDate object can always be converted into a Temporal.PlainYearMonth object.
The abstract operation CreateTemporalYearMonth takes arguments isoYear (an
The abstract operation DifferenceTemporalPlainYearMonth takes arguments operation (
The abstract operation AddDurationToOrSubtractDurationFromPlainYearMonth takes arguments operation (
A Temporal.PlainMonthDay object
The Temporal.PlainMonthDay
extends
clause of a class definition.
Subclass This function performs the following steps when called:
The value of the [[Prototype]] internal slot of the Temporal.PlainMonthDay
The Temporal.PlainMonthDay
The initial value of Temporal.PlainMonthDay.prototype
is %Temporal.PlainMonthDay.prototype%.
This property has the attributes { [[Writable]]:
This function performs the following steps when called:
The Temporal.PlainMonthDay prototype object
The initial value of Temporal.PlainMonthDay.prototype.constructor
is %Temporal.PlainMonthDay%.
The initial value of the
This property has the attributes { [[Writable]]:
Temporal.PlainMonthDay.prototype.calendarId
is an
Temporal.PlainMonthDay.prototype.monthCode
is an
Temporal.PlainMonthDay.prototype.day
is an
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
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:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
Temporal.PlainMonthDay instances are
Internal Slot | Description |
---|---|
[[InitializedTemporalMonthDay]] | The only specified use of this slot is for distinguishing Temporal.PlainMonthDay instances from other objects. |
[[ISOYear]] |
An |
[[ISOMonth]] |
An |
[[ISODay]] |
An |
[[Calendar]] | A String or Object representing the calendar. |
The abstract operation ToTemporalMonthDay takes argument item (an
The abstract operation CreateTemporalMonthDay takes arguments isoMonth (an
Deferring to
A Temporal.TimeZone object
The Temporal.TimeZone
extends
clause of a class definition.
Subclass This function performs the following steps when called:
The value of the [[Prototype]] internal slot of the Temporal.TimeZone
The Temporal.TimeZone
The initial value of Temporal.TimeZone.prototype
is %Temporal.TimeZone.prototype%.
This property has the attributes { [[Writable]]:
This function performs the following steps when called:
The Temporal.TimeZone prototype object
The initial value of Temporal.TimeZone.prototype.constructor
is %Temporal.TimeZone%.
The initial value of the
This property has the attributes { [[Writable]]:
Temporal.TimeZone.prototype.id
is an
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
Temporal.TimeZone instances are
Internal Slot | Description |
---|---|
[[InitializedTemporalTimeZone]] | The only specified use of this slot is for distinguishing Temporal.TimeZone instances from other objects. |
[[Identifier]] |
A String value representing the identifier of an |
[[OffsetMinutes]] |
An |
A Time Zone Methods Record is a
Time Zone Methods Records have the fields listed in
Field Name | Value | Meaning |
---|---|---|
[[Receiver]] | a String or Object | The time zone object, or a string indicating a built-in time zone. |
[[GetOffsetNanosecondsFor]] | a |
The time zone's getOffsetNanosecondsFor method.
For a built-in time zone this is always %Temporal.TimeZone.prototype.getOffsetNanosecondsFor%.
|
[[GetPossibleInstantsFor]] | a |
The time zone's getPossibleInstantsFor method.
For a built-in time zone this is always %Temporal.TimeZone.prototype.getPossibleInstantsFor%.
|
The abstract operation CreateTimeZoneMethodsRecord takes arguments timeZone (a String or Object) and methods (a
The abstract operation TimeZoneMethodsRecordLookup takes arguments timeZoneRec (a
The abstract operation TimeZoneMethodsRecordHasLookedUp takes arguments timeZoneRec (a
The abstract operation TimeZoneMethodsRecordIsBuiltin takes argument timeZoneRec (a
The abstract operation TimeZoneMethodsRecordCall takes arguments timeZoneRec (a
The abstract operation CreateTemporalTimeZone takes argument identifier (a String) and optional argument newTarget (a
Most implementations support only a short, fixed list of
Similar flexibility exists for the storage of the [[OffsetMinutes]] internal slot, which can be interchangeably represented as a 12-bit signed
The abstract operation GetAvailableNamedTimeZoneIdentifier takes argument timeZoneIdentifier (a String) and returns either a
For any timeZoneIdentifier, or any value that is an
Furthermore,
Due to the complexity of supporting these requirements, it is recommended that the result of
The abstract operation GetISOPartsFromEpoch takes argument epochNanoseconds (an
The
The returned value t represents the number of nanoseconds since the
A transition is a point in time where the UTC offset of a time zone changes, for example when Daylight Saving Time starts or stops. The returned value t represents the first nanosecond where the new UTC offset is used in this time zone, not the last nanosecond where the previous UTC offset is used.
Given the same values of timeZoneIdentifier and epochNanoseconds, the result must be the same for the lifetime of the
The minimum implementation of GetNamedTimeZoneNextTransition for ECMAScript implementations that do not include local political rules for any time zones performs the following steps when called:
The
The returned value t represents the number of nanoseconds since the
A transition is a point in time where the UTC offset of a time zone changes, for example when Daylight Saving Time starts or stops. The returned value t represents the first nanosecond where the new UTC offset is used in this time zone, not the last nanosecond where the previous UTC offset is used.
Given the same values of timeZoneIdentifier and epochNanoseconds, the result must be the same for the lifetime of the
The minimum implementation of GetNamedTimeZonePreviousTransition for ECMAScript implementations that do not include local political rules for any time zones performs the following steps when called:
The abstract operation FormatOffsetTimeZoneIdentifier takes argument offsetMinutes (an
The abstract operation FormatUTCOffsetNanoseconds takes argument offsetNanoseconds (an
The abstract operation FormatDateTimeUTCOffsetRounded takes argument offsetNanoseconds (an
The abstract operation ObjectImplementsTemporalTimeZoneProtocol takes argument object (an Object) and returns either a
The abstract operation ToTemporalTimeZoneSlotValue takes argument temporalTimeZoneLike (an ECMAScript value) and returns either a
The abstract operation ToTemporalTimeZoneIdentifier takes argument timeZoneSlotValue (a String or Object) and returns either a
The abstract operation ToTemporalTimeZoneObject takes argument timeZoneSlotValue (a String or Object) and returns an Object. It obtains a time zone object for a value timeZoneSlotValue stored in a Temporal.ZonedDateTime's [[TimeZone]] internal slot. It performs the following steps when called:
The abstract operation GetOffsetNanosecondsFor takes arguments timeZoneRec (a getOffsetNanosecondsFor
method of the given time zone.
It performs the following steps when called:
The abstract operation GetOffsetStringFor takes arguments timeZoneRec (a Temporal.TimeZone.prototype.getOffsetStringFor
method.
If the given time zone is not built-in, it observably calls the time zone's getOffsetNanosecondsFor
method.
It performs the following steps when called:
The abstract operation GetPlainDateTimeFor takes arguments timeZoneRec (a Temporal.TimeZone.prototype.getPlainDateTimeFor
method.
If the given time zone is not built-in, it observably calls timeZone's getOffsetNanosecondsFor
method unless precalculatedOffsetNanoseconds is supplied.
It performs the following steps when called:
The abstract operation GetInstantFor takes arguments timeZoneRec (a Temporal.TimeZone.prototype.getInstantFor
method.
It calls the timeZoneRec's getPossibleInstantsFor
method at least once.
If that call returns an empty array and disambiguation is not getOffsetNanosecondsFor
method twice, and getPossibleInstantsFor
an additional time.
It performs the following steps when called:
The abstract operation DisambiguatePossibleInstants takes arguments possibleInstants (a Temporal.Instant
instances the one indicated by the disambiguation parameter.
The possibleInstants getOffsetNanosecondsFor
method twice, and getPossibleInstantsFor
once, if disambiguation is not
The abstract operation GetPossibleInstantsFor takes arguments timeZoneRec (a getPossibleInstantsFor
method of the given time zone.
It performs the following steps when called:
The abstract operation TimeZoneEquals takes arguments one (a String or Object) and two (a String or Object) and returns either a
The abstract operation ParseTimeZoneIdentifier takes argument identifier (a String) and returns either a
A Temporal.Calendar object
At a minimum, ECMAScript implementations must support a built-in calendar named
ECMAScript implementations identify built-in calendars using a calendar type as defined by Unicode Technical Standard #35, Part 4, Section 2. Their canonical form is a string containing only Unicode Basic Latin lowercase letters (U+0061 LATIN SMALL LETTER A through U+007A LATIN SMALL LETTER Z, inclusive) and/or digits (U+0030 DIGIT ZERO through U+0039 DIGIT NINE, inclusive), with zero or more medial hyphens (U+002D HYPHEN-MINUS).
Temporal.Calendar
constructorTemporal.Calendar
object.
When called with any other string, it will throw a
The abstract operation IsBuiltinCalendar takes argument id (a String) and returns a Boolean. The returned value is
The
A Calendar Methods Record is a
Calendar Methods Records have the fields listed in
Field Name | Value | Meaning |
---|---|---|
[[Receiver]] | a String or Object | The calendar object, or a string indicating a built-in time zone. |
[[DateAdd]] | a |
The calendar's dateAdd method.
For a built-in calendar this is always %Temporal.Calendar.prototype.dateAdd%.
|
[[DateFromFields]] | a |
The calendar's dateFromFields method.
For a built-in calendar this is always %Temporal.Calendar.prototype.dateFromFields%.
|
[[DateUntil]] | a |
The calendar's dateUntil method.
For a built-in calendar this is always %Temporal.Calendar.prototype.dateUntil%.
|
[[Day]] | a |
The calendar's day method.
For a built-in calendar this is always %Temporal.Calendar.prototype.day%.
|
[[Fields]] | a |
The calendar's fields method.
For a built-in calendar this is always %Temporal.Calendar.prototype.fields%.
|
[[MergeFields]] | a |
The calendar's mergeFields method.
For a built-in calendar this is always %Temporal.Calendar.prototype.mergeFields%.
|
[[MonthDayFromFields]] | a |
The calendar's monthDayFromFields method.
For a built-in calendar this is always %Temporal.Calendar.prototype.monthDayFromFields%.
|
[[YearMonthFromFields]] | a |
The calendar's yearMonthFromFields method.
For a built-in calendar this is always %Temporal.Calendar.prototype.yearMonthFromFields%.
|
The abstract operation CreateCalendarMethodsRecord takes arguments calendar (a String or Object) and methods (a
The abstract operation CreateCalendarMethodsRecordFromRelativeTo takes arguments plainRelativeTo (a Temporal.PlainDate
or Temporal.ZonedDateTime
or relativeTo
object, looking up the methods given in methods. If no relativeTo
object is given, it returns
The abstract operation CalendarMethodsRecordLookup takes arguments calendarRec (a
The abstract operation CalendarMethodsRecordHasLookedUp takes arguments calendarRec (a
The abstract operation CalendarMethodsRecordIsBuiltin takes argument calendarRec (a
The abstract operation CalendarMethodsRecordCall takes arguments calendarRec (a
The abstract operation CreateTemporalCalendar takes argument identifier (a String) and optional argument newTarget (a
The abstract operation CalendarFields takes arguments calendarRec (a fields
method of the given calendar with an array representation of fieldNames, and returns a
The abstract operation CalendarMergeFields takes arguments calendarRec (a mergeFields
method of the given calendar. It performs the following steps when called:
The abstract operation CalendarDateAdd takes arguments calendarRec (a dateAdd
method of the given calendar.
It performs the following steps when called:
The abstract operation CalendarDateUntil takes arguments calendarRec (a dateUntil
method of the given calendar.
It performs the following steps when called:
The abstract operation CalendarYear takes arguments calendar (a String or Object) and dateLike (a Temporal.PlainDateTime, Temporal.PlainDate, or Temporal.PlainYearMonth) and returns either a year()
method and validates the result. It performs the following steps when called:
The abstract operation CalendarMonth takes arguments calendar (a String or Object) and dateLike (a Temporal.PlainDateTime, Temporal.PlainDate, or Temporal.PlainYearMonth) and returns either a month()
method and validates the result. It performs the following steps when called:
The abstract operation CalendarMonthCode takes arguments calendar (a String or Object) and dateLike (a Temporal.PlainDateTime, Temporal.PlainDate, Temporal.PlainYearMonth, or Temporal.PlainMonthDay) and returns either a monthCode()
method and validates the result. It performs the following steps when called:
The abstract operation CalendarDay takes arguments calendarRec (a day()
method and validates the result. It performs the following steps when called:
The abstract operation CalendarDayOfWeek takes arguments calendar (a String or Object) and dateLike (a Temporal.PlainDateTime or Temporal.PlainDate) and returns either a dayOfWeek()
method and validates the result. It performs the following steps when called:
The abstract operation CalendarDayOfYear takes arguments calendar (a String or Object) and dateLike (a Temporal.PlainDateTime or Temporal.PlainDate) and returns either a dayOfYear()
method and validates the result. It performs the following steps when called:
The abstract operation CalendarWeekOfYear takes arguments calendar (a String or Object) and dateLike (a Temporal.PlainDateTime or Temporal.PlainDate) and returns either a weekOfYear()
method and validates the result. It performs the following steps when called:
The abstract operation CalendarYearOfWeek takes arguments calendar (a String or Object) and dateLike (a Temporal.PlainDateTime or Temporal.PlainDate) and returns either a yearOfWeek()
method and validates the result. It performs the following steps when called:
The abstract operation CalendarDaysInWeek takes arguments calendar (a String or Object) and dateLike (a Temporal.PlainDateTime or Temporal.PlainDate) and returns either a daysInWeek()
method and validates the result. It performs the following steps when called:
The abstract operation CalendarDaysInMonth takes arguments calendar (a String or Object) and dateLike (a Temporal.PlainDateTime, Temporal.PlainDate, or Temporal.PlainYearMonth) and returns either a daysInMonth()
method and validates the result. It performs the following steps when called:
The abstract operation CalendarDaysInYear takes arguments calendar (a String or Object) and dateLike (a Temporal.PlainDateTime, Temporal.PlainDate, or Temporal.PlainYearMonth) and returns either a daysInYear()
method and validates the result. It performs the following steps when called:
The abstract operation CalendarMonthsInYear takes arguments calendar (a String or Object) and dateLike (a Temporal.PlainDateTime, Temporal.PlainDate, or Temporal.PlainYearMonth) and returns either a monthsInYear()
method and validates the result. It performs the following steps when called:
The abstract operation CalendarInLeapYear takes arguments calendar (a String or Object) and dateLike (a Temporal.PlainDateTime, Temporal.PlainDate, or Temporal.PlainYearMonth) and returns either a inLeapYear()
method and validates the result. It performs the following steps when called:
The abstract operation ObjectImplementsTemporalCalendarProtocol takes argument object (an Object) and returns either a
The abstract operation ToTemporalCalendarSlotValue takes argument temporalCalendarLike (an ECMAScript value) and optional argument default (a String) and returns either a
The abstract operation GetTemporalCalendarSlotValueWithISODefault takes argument item (an Object) and returns either a calendar
property on the given item and converts its value into another value suitable for storing in a Temporal object's [[Calendar]] internal slot.
If no such property is present, the built-in ISO 8601 calendar is returned.
It performs the following steps when called:
The abstract operation ToTemporalCalendarIdentifier takes argument calendarSlotValue (a String or Object) and returns either a
The abstract operation ToTemporalCalendarObject takes argument calendarSlotValue (a String or Object) and returns an Object. It obtains a calendar object for a value calendarSlotValue stored in a Temporal object's [[Calendar]] internal slot. It performs the following steps when called:
The abstract operation CalendarDateFromFields takes arguments calendarRec (a Temporal.PlainDate
or an dateFromFields()
method and validates the result.
It performs the following steps when called:
The abstract operation CalendarYearMonthFromFields takes arguments calendarRec (a Temporal.PlainYearMonth
or an yearMonthFromFields()
method and validates the result. It performs the following steps when called:
The abstract operation CalendarMonthDayFromFields takes arguments calendarRec (a Temporal.PlainMonthDay
or an monthDayFromFields()
method and validates the result. It performs the following steps when called:
The abstract operation MaybeFormatCalendarAnnotation takes arguments calendar (a String or Object) and showCalendar (one of
The abstract operation FormatCalendarAnnotation takes arguments id (a String) and showCalendar (one of
The abstract operation CalendarEquals takes arguments one (a String or Object) and two (a String or Object) and returns either a
The abstract operation ConsolidateCalendars takes arguments one (a String or Object) and two (a String or Object) and returns either a
The abstract operation ISODaysInMonth takes arguments year (an
The abstract operation ToISOWeekOfYear takes arguments year (an
The abstract operation ISOMonthCode takes argument month (an
The abstract operation ISOResolveMonth takes argument fields (an Object) and returns either a
The ISODateFromFields abstract operation implements the calendar-specific logic in the Temporal.Calendar.prototype.dateFromFields
method for the ISO 8601 calendar.
The ISOYearMonthFromFields abstract operation implements the calendar-specific logic in the Temporal.Calendar.prototype.yearMonthFromFields
method for the ISO 8601 calendar.
It returns a
The ISOMonthDayFromFields abstract operation implements the calendar-specific logic in the Temporal.Calendar.prototype.monthDayFromFields
method for the ISO 8601 calendar.
The abstract operation ISOFieldKeysToIgnore takes argument keys (a
The abstract operation ToISODayOfYear takes arguments year (an
The abstract operation ToISODayOfWeek takes arguments year (an
The Temporal.Calendar
extends
clause of a class definition.
Subclass
The Temporal.Calendar
function performs the following steps when called:
The Temporal.Calendar prototype:
The initial value of Temporal.Calendar.prototype
is %Temporal.Calendar.prototype%.
This property has the attributes { [[Writable]]:
The Temporal.Calendar.from
function performs the following steps when called:
The Temporal.Calendar prototype object
The initial value of Temporal.Calendar.prototype.constructor
is %Temporal.Calendar%.
The initial value of the
This property has the attributes { [[Writable]]:
Temporal.Calendar.prototype.id
is an
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the Temporal.Calendar.prototype.dateFromFields
method as specified in the ECMA-402 specification.
An ECMAScript implementation that does not include the ECMA-402 API, may still include support for built-in calendars (see
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the Temporal.Calendar.prototype.yearMonthFromFields
method as specified in the ECMA-402 specification.
An ECMAScript implementation that does not include the ECMA-402 API, may still include support for built-in calendars (see
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the Temporal.Calendar.prototype.monthDayFromFields
method as specified in the ECMA-402 specification.
An ECMAScript implementation that does not include the ECMA-402 API, may still include support for built-in calendars (see
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the Temporal.Calendar.prototype.dateAdd
method as specified in the ECMA-402 specification.
An ECMAScript implementation that does not include the ECMA-402 API, may still include support for built-in calendars (see
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the Temporal.Calendar.prototype.dateUntil
method as specified in the ECMA-402 specification.
An ECMAScript implementation that does not include the ECMA-402 API, may still include support for built-in calendars (see
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the Temporal.Calendar.prototype.year
method as specified in the ECMA-402 specification.
An ECMAScript implementation that does not include the ECMA-402 API, may still include support for built-in calendars (see
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the Temporal.Calendar.prototype.month
method as specified in the ECMA-402 specification.
An ECMAScript implementation that does not include the ECMA-402 API, may still include support for built-in calendars (see
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the Temporal.Calendar.prototype.monthCode
method as specified in the ECMA-402 specification.
An ECMAScript implementation that does not include the ECMA-402 API, may still include support for built-in calendars (see
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the Temporal.Calendar.prototype.day
method as specified in the ECMA-402 specification.
An ECMAScript implementation that does not include the ECMA-402 API, may still include support for built-in calendars (see
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the Temporal.Calendar.prototype.dayOfWeek
method as specified in the ECMA-402 specification.
An ECMAScript implementation that does not include the ECMA-402 API, may still include support for built-in calendars (see
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the Temporal.Calendar.prototype.dayOfYear
method as specified in the ECMA-402 specification.
An ECMAScript implementation that does not include the ECMA-402 API, may still include support for built-in calendars (see
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the Temporal.Calendar.prototype.weekOfYear
method as specified in the ECMA-402 specification.
An ECMAScript implementation that does not include the ECMA-402 API, may still include support for built-in calendars (see
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.
This method performs the following steps when called:
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the Temporal.Calendar.prototype.daysInWeek
method as specified in the ECMA-402 specification.
An ECMAScript implementation that does not include the ECMA-402 API, may still include support for built-in calendars (see
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the Temporal.Calendar.prototype.daysInMonth
method as specified in the ECMA-402 specification.
An ECMAScript implementation that does not include the ECMA-402 API, may still include support for built-in calendars (see
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the Temporal.Calendar.prototype.daysInYear
method as specified in the ECMA-402 specification.
An ECMAScript implementation that does not include the ECMA-402 API, may still include support for built-in calendars (see
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the Temporal.Calendar.prototype.monthsInYear
method as specified in the ECMA-402 specification.
An ECMAScript implementation that does not include the ECMA-402 API, may still include support for built-in calendars (see
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the Temporal.Calendar.prototype.inLeapYear
method as specified in the ECMA-402 specification.
An ECMAScript implementation that does not include the ECMA-402 API, may still include support for built-in calendars (see
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the Temporal.Calendar.prototype.fields
method as specified in the ECMA-402 specification.
An ECMAScript implementation that does not include the ECMA-402 API, may still include support for built-in calendars (see
An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the Temporal.Calendar.prototype.mergeFields
method as specified in the ECMA-402 specification.
An ECMAScript implementation that does not include the ECMA-402 API, may still include support for built-in calendars (see
The Temporal.Calendar.prototype.toString
method performs the following steps when called:
The Temporal.Calendar.prototype.toJSON
method performs the following steps when called:
Temporal.Calendar instances are
The abstract operation IteratorToListOfType takes arguments iteratorRecord (an
The abstract operation ISODateToEpochDays takes arguments year (an
The abstract operation EpochDaysToEpochMs takes arguments day (an
A given time t belongs to day number
Number of days in year are given by:
The day number of the first day of year y is given by:
The time of the start of a year is:
The following function returns 1 for a time within leap year otherwise it returns 0:
The month number for a time t is given by:
where
A month value of 0 specifies January; 1 specifies February; 2 specifies March; 3 specifies April; 4 specifies May; 5 specifies June; 6 specifies July; 7 specifies August; 8 specifies September; 9 specifies October; 10 specifies November; and 11 specifies December. Note that
The date number for a time t is given by:
The weekday for a particular time t is defined as:
A weekday value of 0 specifies Sunday; 1 specifies Monday; 2 specifies Tuesday; 3 specifies Wednesday; 4 specifies Thursday; 5 specifies Friday; and 6 specifies Saturday. Note that
The abstract operation GetOptionsObject takes argument options (an
The abstract operation GetOption takes arguments options (an Object), property (a
The abstract operation ToTemporalOverflow takes argument options (an Object or
The abstract operation ToTemporalDisambiguation takes argument options (an Object or
The abstract operation ToTemporalRoundingMode takes arguments normalizedOptions (an Object) and fallback (a String from the Identifier column of
Identifier | Description | Examples: Round to 0 fraction digits | ||||
---|---|---|---|---|---|---|
-1.5 | 0.4 | 0.5 | 0.6 | 1.5 | ||
Toward positive infinity | ⬆️ [-1] | ⬆️ [1] | ⬆️ [1] | ⬆️ [1] | ⬆️ [2] | |
Toward negative infinity | ⬇️ [-2] | ⬇️ [0] | ⬇️ [0] | ⬇️ [0] | ⬇️ [1] | |
Away from zero | ⬇️ [-2] | ⬆️ [1] | ⬆️ [1] | ⬆️ [1] | ⬆️ [2] | |
Toward zero | ⬆️ [-1] | ⬇️ [0] | ⬇️ [0] | ⬇️ [0] | ⬇️ [1] | |
Ties toward positive infinity | ⬆️ [-1] | ⬇️ [0] | ⬆️ [1] | ⬆️ [1] | ⬆️ [2] | |
Ties toward negative infinity | ⬇️ [-2] | ⬇️ [0] | ⬇️ [0] | ⬆️ [1] | ⬇️ [1] | |
Ties away from zero | ⬇️ [-2] | ⬇️ [0] | ⬆️ [1] | ⬆️ [1] | ⬆️ [2] | |
Ties toward zero | ⬆️ [-1] | ⬇️ [0] | ⬇️ [0] | ⬆️ [1] | ⬇️ [1] | |
Ties toward an even rounding increment multiple | ⬇️ [-2] | ⬇️ [0] | ⬇️ [0] | ⬆️ [1] | ⬆️ [2] |
The abstract operation NegateTemporalRoundingMode takes argument roundingMode (a String from the Identifier column of
The abstract operation ToTemporalOffset takes arguments options (an Object or
The abstract operation ToCalendarNameOption takes argument normalizedOptions (an Object) and returns either a
toString
methods in Temporal to control whether a calendar annotation should be output.
It performs the following steps when called:
The abstract operation ToTimeZoneNameOption takes argument normalizedOptions (an Object) and returns either a
Temporal.ZonedDateTime.prototype.toString()
.
It is different from the timeZone
property passed to Temporal.ZonedDateTime.from()
and from the timeZone
property in the options passed to Temporal.Instant.prototype.toString()
.
It performs the following steps when called:
The abstract operation ToShowOffsetOption takes argument normalizedOptions (an Object) and returns either a
Temporal.ZonedDateTime.prototype.toString()
.
It is different from the offset
property passed to Temporal.ZonedDateTime.from()
.
It performs the following steps when called:
The abstract operation ToTemporalRoundingIncrement takes argument normalizedOptions (an Object) and returns either a
The abstract operation ValidateTemporalRoundingIncrement takes arguments increment (a positive
The abstract operation ToFractionalSecondDigits takes argument normalizedOptions (an Object) and returns either a
The abstract operation ToSecondsStringPrecisionRecord takes arguments smallestUnit (
The abstract operation GetTemporalUnit takes arguments normalizedOptions (an Object), key (a
Both singular and plural unit names are accepted, but only the singular form is used internally.
Singular | Plural | Category |
---|---|---|
The abstract operation ToRelativeTemporalObject takes argument options (an Object) and returns either a relativeTo
property of its options argument.
If the value is
If the returned
The abstract operation LargerOfTwoTemporalUnits takes arguments u1 (a String from the Singular column of
The abstract operation IsCalendarUnit takes argument unit (a String from the Singular column of
The abstract operation MaximumTemporalDurationRoundingIncrement takes argument unit (a String from the Singular column of
The abstract operation IsPartialTemporalObject takes argument object (an with()
methods: it must be an Object, it must not be an instance of one of the time-related or date-related Temporal types, and it must not have a calendar
or timeZone
property. It performs the following steps when called:
The abstract operation FormatFractionalSeconds takes arguments subSecondNanoseconds (an
The abstract operation FormatTimeString takes arguments hour (a non-negative
The abstract operation GetUnsignedRoundingMode takes arguments roundingMode (a String from the Identifier column of
Identifier | Sign | Unsigned Rounding Mode |
---|---|---|
The abstract operation ApplyUnsignedRoundingMode takes arguments x (a
The abstract operation RoundNumberToIncrement takes arguments x (a
The abstract operation RoundNumberToIncrementAsIfPositive takes arguments x (a
Several operations in this section are intended to parse ISO 8601 strings representing a date, a time, a duration, or a combined date and time. For the purposes of these operations, a valid ISO 8601 string is defined as a string that can be generated by one of the goal elements of the following grammar.
This grammar is adapted from the ABNF grammar of ISO 8601 that is given in appendix A of RFC 3339, augmented with the grammar of annotations in section 3.1 of Date and Time on the Internet: Timestamps with additional information
The grammar deviates from the standard given in ISO 8601 in the following ways:
!
, in which case they are rejected.
Note that the suffix keys, although they look similar, are not the same as keys in RFC 6067.
In particular, keys are lowercase-only.
-
or :
separators), as long as each such part is itself in either basic format or extended format (e.g., --
as in RFC 3339 Appendix A.
000000
).
The abstract operation ParseISODateTime takes argument isoString (a String). It parses the argument as an ISO 8601 string and returns a
It performs the following steps when called:
The abstract operation ParseTemporalInstantString takes argument isoString (a String) and returns either a
The abstract operation ParseTemporalZonedDateTimeString takes argument isoString (a String). It parses the argument as an ISO 8601 string and returns a
The abstract operation ParseTemporalCalendarString takes argument isoString (a String). It parses the argument as an ISO 8601 string and returns the calendar identifier, or
The abstract operation ParseTemporalDateString takes argument isoString (a String). It parses the argument as a full or partial ISO 8601 string and returns a
The abstract operation ParseTemporalDateTimeString takes argument isoString (a String). It parses the argument as an ISO 8601 string and returns a
The abstract operation ParseTemporalDurationString takes argument isoString (a String) and returns either a
It performs the following steps when called:
The abstract operation ParseTemporalMonthDayString takes argument isoString (a String). It parses the argument as an ISO 8601 string and returns a
The abstract operation ParseTemporalRelativeToString takes argument isoString (a String). It parses the argument as an ISO 8601 string and returns the information needed to construct either a Temporal.ZonedDateTime or a Temporal.PlainDate instance, e.g. as the value of a relativeTo
option. It performs the following steps when called:
The abstract operation ParseTemporalTimeString takes argument isoString (a String). It parses the argument as an ISO 8601 time of day and returns the information needed to construct a Temporal.PlainTime instance. It performs the following steps when called:
A successful parse using
The abstract operation ParseTemporalTimeZoneString takes argument timeZoneString (a String) and returns either a
The abstract operation ParseTemporalYearMonthString takes argument isoString (a String). It parses the argument as a full or partial ISO 8601 string and returns a
The abstract operation ToPositiveIntegerWithTruncation takes argument argument (an
The abstract operation ToIntegerWithTruncation takes argument argument (an
The abstract operation ToIntegerIfIntegral takes argument argument (an
The abstract operation PrepareTemporalFields takes arguments fields (an Object), fieldNames (a
Property | Conversion | Default |
---|---|---|
A Calendar Field Descriptor Record is a
Calendar Field Descriptor Records have the fields listed in
Field Name | Value | Meaning |
---|---|---|
[[Property]] | a String | The |
[[Conversion]] | an |
The means by which purported values are coerced to a static representation of the correct type (or rejected if that fails), analogous to steps indicated by the Conversion column of |
[[Required]] | a Boolean | Whether |
The abstract operation GetDifferenceSettings takes arguments operation (
This section lists amendments which must be made to ECMA-262, the ECMAScript® 2023 Language Specification, other than the addition of the new sections specifying the Temporal object and everything related to it.
Text to be added is marked like this, and text to be deleted is marked like this.
Blocks of unmodified text between modified sections are marked by [...].
This section intends to move the definitions of ASCII-uppercase, ASCII-lowercase, and ASCII-case-insensitive match from ECMA-402 into ECMA-262, after the definition of
[...]
The ASCII-uppercase of a String S is the String derived from S by replacing each occurrence of an ASCII lowercase letter code unit (0x0061 through 0x007A, inclusive) with the corresponding ASCII uppercase letter code unit (0x0041 through 0x005A, inclusive) while preserving all other code units.
The ASCII-lowercase of a String S is the String derived from S by replacing each occurrence of an ASCII uppercase letter code unit (0x0041 through 0x005A, inclusive) with the corresponding ASCII lowercase letter code unit (0x0061 through 0x007A, inclusive) while preserving all other code units.
A String A is an ASCII-case-insensitive match for a String B if the ASCII-lowercase of A is the ASCII-lowercase of B.
The Year-Week Record specification type is returned by the week number calculation in
Year-Week Records have the fields listed in table
Field Name | Value | Meaning |
---|---|---|
[[Week]] | a positive |
The calendar week of year. |
[[Year]] | an |
The week calendar year. |
The abstract operation SortStringListByCodeUnit takes argument strings (a
[...]
The notation “
The mathematical function
[...]
Mathematical functions
[...]
The abstract operation CopyDataProperties takes arguments target (an Object), source (an excludedItems (a , and excludedKeys (a
The target passed in here is always a newly created object which is not directly accessible in case of an error being thrown.
The abstract operation SnapshotOwnProperties takes arguments source (an Object) and proto (an Object or
[...]
The abstract operation GetUTCEpochNanoseconds takes arguments year (an
Time zones in ECMAScript are represented by time zone identifiers, which are Strings composed entirely of code units in the 0x0000 to 0x007F0x0021 to 0x007E.
Time zones supported by an ECMAScript implementation may be available named time zones, represented by the [[Identifier]] field of the
A primary time zone identifier is the preferred identifier for an available named time zone. A non-primary time zone identifier is an identifier for an available named time zone that is not a primary time zone identifier. An available named time zone identifier is either a primary time zone identifier or a non-primary time zone identifier. Each available named time zone identifier is associated with exactly one available named time zone. Each available named time zone is associated with exactly one primary time zone identifier and zero or more non-primary time zone identifiers.
Time zone identifiers are compared using
ECMAScript implementations must support an available named time zone with the identifier
Implementations that follow the requirements for time zones as described in the ECMA-402 Internationalization API specification are called time zone aware.
Time zone aware implementations must support available named time zones corresponding to the Zone and Link names of the IANA Time Zone Database, and only such names.
In time zone aware implementations, a primary time zone identifier is a Zone name, and a non-primary time zone identifier is a Link name, respectively, in the IANA Time Zone Database except as specifically overridden by
The
The a String representing a UTC offset for which a
To ensure the level of functionality that implementations commonly provide in the methods of the Date object, it is recommended that SystemTimeZoneIdentifier return an IANA time zone name corresponding to the
For example, if the
ECMAScript defines a string interchange format for UTC offsets, derived from ISO 8601.
The format is described by the following grammar.
The usage of Unicode code points in this grammar is listed in
ECMAScript defines string interchange formats for UTC offsets, derived from ISO 8601.
UTC offsets that represent
These formats are described by the ISO String grammar in
[...]
The abstract operation LocalTime takes argument t (a
If political rules for the local time t are not available within the implementation, the result is t because
It is required for
Two different input
The abstract operation UTC takes argument t (a Number) and returns a
Input t is nominally a
If political rules for the local time t are not available within the implementation, the result is t because
It is required for
1:30 AM on 5 November 2017 in America/New_York is repeated twice (fall backward), but it must be interpreted as 1:30 AM UTC-04 instead of 1:30 AM UTC-05.
In UTC(
2:30 AM on 12 March 2017 in America/New_York does not exist, but it must be interpreted as 2:30 AM UTC-05 (equivalent to 3:30 AM UTC-04).
In UTC(
[...]
The abstract operation TimeString takes argument tv (a Number, but not
[...]
The abstract operation TimeZoneString takes argument tv (an
The abstract operation IsOffsetTimeZoneIdentifier takes argument offsetString (a String) and returns a Boolean. The return value indicates whether offsetString conforms to the grammar given by
The abstract operation ParseDateTimeUTCOffset takes argument offsetString (a String) and returns either a
This function performs the following steps when called:
parse
method (This function returns the
This function performs the following steps when called:
This method performs the following steps when called:
This section lists amendments which must be made to ECMA-402, the ECMAScript® 2023 Internationalization API Specification.
Text to be added is marked like this, and text to be deleted is marked like this.
Blocks of unmodified text between modified sections are marked by [...].
This text is based on top of the ECMA-402 spec text from commit 537afda7be28a443b79b3fd7e6c836a16ce4f75f.
These definitions are moved into ECMA-262.
The String values used to identify locales, currencies, scripts, and time zones are interpreted in an
The
The
A String value A is an
Implementations that adopt this specification are
Except as overridden by
In the IANA Time Zone Database, the UTC time zone is represented by the Zone
The IANA Time Zone Database is typically updated between five and ten times per year.
These updates may add new Zone or Link names, may change Zones to Links, and may change the UTC offsets and transitions associated with any Zone.
ECMAScript implementations are recommended to include updates to the IANA Time Zone Database as soon as possible.
Such prompt action ensures that ECMAScript programs can accurately perform time-zone-sensitive calculations and can use newly-added
Although the IANA Time Zone Database maintainers strive for stability, in rare cases (averaging less than once per year) a Zone may be replaced by a new Zone.
For example, in 2022 "
To reduce disruption from renaming changes, ECMAScript implementations are encouraged to initially add the new Zone as a
A waiting period should only apply when a new Zone is added to replace an existing Zone. If an existing Zone and Link are swapped, then no waiting period is necessary.
If implementations revise time zone information during the lifetime of an
This section complements but does not supersede
The IANA Time Zone Database offers build options that affect which PACKRATDATA=backzone PACKRATLIST=zone.tab
or a similar alternative that ensures at least one primary identifier for each ISO 3166-1 Alpha-2 country code.
The
This definition supersedes the definition provided in
This specification identifies time zones using the Zone and Link names of the IANA Time Zone Database. Their canonical form is the corresponding Zone name in the casing used in the IANA Time Zone Database except as specifically overridden by
A conforming implementation must recognize
The abstract operation IsValidTimeZoneName takes argument timeZone (a String) and returns a Boolean. It verifies that the timeZone argument represents a valid Zone or Link name of the IANA Time Zone Database. It performs the following steps when called:
The abstract operation CanonicalizeTimeZoneName takes argument timeZone (a String value that is a valid time zone name as verified by
backward
of the IANA Time Zone Database.The
[...]
[...]
When the supportedValuesOf
method is called with argument key , the following steps are taken:
In this section, some
The abstract operation
[...]
The abstract operation
[...]
Identifier | Description | Examples: Round to 0 fraction digits | ||||
---|---|---|---|---|---|---|
-1.5 | 0.4 | 0.5 | 0.6 | 1.5 | ||
Toward positive infinity | ⬆️ [-1] | ⬆️ [1] | ⬆️ [1] | ⬆️ [1] | ⬆️ [2] | |
Toward negative infinity | ⬇️ [-2] | ⬇️ [0] | ⬇️ [0] | ⬇️ [0] | ⬇️ [1] | |
Away from zero | ⬇️ [-2] | ⬆️ [1] | ⬆️ [1] | ⬆️ [1] | ⬆️ [2] | |
Toward zero | ⬆️ [-1] | ⬇️ [0] | ⬇️ [0] | ⬇️ [0] | ⬇️ [1] | |
Ties toward positive infinity | ⬆️ [-1] | ⬇️ [0] | ⬆️ [1] | ⬆️ [1] | ⬆️ [2] | |
Ties toward negative infinity | ⬇️ [-2] | ⬇️ [0] | ⬇️ [0] | ⬆️ [1] | ⬇️ [1] | |
Ties away from zero | ⬇️ [-2] | ⬇️ [0] | ⬆️ [1] | ⬆️ [1] | ⬆️ [2] | |
Ties toward zero | ⬆️ [-1] | ⬇️ [0] | ⬇️ [0] | ⬆️ [1] | ⬇️ [1] | |
Ties toward an even rounding increment multiple | ⬇️ [-2] | ⬇️ [0] | ⬇️ [0] | ⬆️ [1] | ⬆️ [2] |
The abstract operation
Identifier | Sign | Unsigned Rounding Mode |
---|---|---|
The abstract operation
[...]
The abstract operation CreateDateTimeFormat takes arguments newTarget (a
Temporal.ZonedDateTime.prototype.toLocaleString
.
It performs the following steps when called:
type
Unicode locale nonterminal, throw a type
Unicode locale nonterminal, throw a Pattern | Supported fields | Default fields |
---|---|---|
[[TemporalPlainDatePattern]] | [[weekday]], [[era]], [[year]], [[month]], [[day]] | [[year]], [[month]], [[day]] |
[[TemporalPlainYearMonthPattern]] | [[era]], [[year]], [[month]] | [[year]], [[month]] |
[[TemporalPlainMonthDayPattern]] | [[month]], [[day]] | [[month]], [[day]] |
[[TemporalPlainTimePattern]] | [[hour]], [[minute]], [[second]], [[dayPeriod]], [[fractionalSecondDigits]] | [[hour]], [[minute]], [[second]] |
[[TemporalPlainDateTimePattern]] | [[weekday]], [[era]], [[year]], [[month]], [[day]], [[hour]], [[minute]], [[second]], [[dayPeriod]], [[fractionalSecondDigits]] | [[year]], [[month]], [[day]], [[hour]], [[minute]], [[second]] |
[[TemporalInstantPattern]] | [[weekday]], [[era]], [[year]], [[month]], [[day]], [[hour]], [[minute]], [[second]], [[dayPeriod]], [[fractionalSecondDigits]], [[timeZoneName]] | [[year]], [[month]], [[day]], [[hour]], [[minute]], [[second]] |
A DateTime format function is an anonymous built-in function that has a [[DateTimeFormat]] internal slot.
When a DateTime format function F is called with optional argument date, the following steps are taken:
The
The abstract operation FormatDateTimePattern takes arguments dateTimeFormat (an Intl.DateTimeFormat), pattern (a x (a Number), epochNanoseconds (a BigInt), and rangeFormatOptions (a range pattern interprets x as a creates the corresponding parts for the
The abstract operation PartitionDateTimePattern takes arguments dateTimeFormat (an Intl.DateTimeFormat) and x (a Number or an Object for which a an
The abstract operation FormatDateTime takes arguments dateTimeFormat (an Intl.DateTimeFormat) and x (a Number or an Object for which
The abstract operation FormatDateTimeToParts takes arguments dateTimeFormat (an Intl.DateTimeFormat) and x (a Number or an Object for which
The abstract operation PartitionDateTimeRangePattern takes arguments dateTimeFormat (an Intl.DateTimeFormat), x (a Number or an Object for which a
The abstract operation FormatDateTimeRange takes arguments dateTimeFormat (an Intl.DateTimeFormat), x (a Number or an Object for which
The abstract operation FormatDateTimeRangeToParts takes arguments dateTimeFormat (an Intl.DateTimeFormat), x (a Number or an Object for which
The abstract operation ToDateTimeFormattable takes argument value (an
The abstract operation IsTemporalObject takes argument value (an
The abstract operation SameTemporalType takes arguments x (an
The abstract operation GetDateTimeFormatPattern takes arguments required (
Each Value Format Record has the fields
defined in
Field Name | Value Type |
---|---|
[[pattern]] | a String value as described in |
[[rangePatterns]] | a |
[[epochNanoseconds]] | a BigInt |
The abstract operation HandleDateTimeTemporalDate takes arguments dateTimeFormat (an Intl.DateTimeFormat) and temporalDate (a Temporal.PlainDate) and returns either a
The abstract operation HandleDateTimeTemporalYearMonth takes arguments dateTimeFormat (an Intl.DateTimeFormat) and temporalYearMonth (a Temporal.PlainYearMonth) and returns either a
The abstract operation HandleDateTimeTemporalMonthDay takes arguments dateTimeFormat (an Intl.DateTimeFormat) and temporalMonthDay (a Temporal.PlainMonthDay) and returns either a
The abstract operation HandleDateTimeTemporalTime takes arguments dateTimeFormat (an Intl.DateTimeFormat) and temporalTime (a Temporal.PlainTime) and returns either a
The abstract operation HandleDateTimeTemporalDateTime takes arguments dateTimeFormat (an Intl.DateTimeFormat) and dateTime (a Temporal.PlainDateTime) and returns either a
The abstract operation HandleDateTimeTemporalInstant takes arguments dateTimeFormat (an Intl.DateTimeFormat) and instant (a Temporal.Instant) and returns either a
The abstract operation HandleDateTimeOthers takes arguments dateTimeFormat (an Intl.DateTimeFormat) and x (a Number) and returns either a
The abstract operation HandleDateTimeValue takes arguments dateTimeFormat (an Intl.DateTimeFormat) and x (a Number, or an Object for which
The
When the formatToParts
method is called with an argument date, the following steps are taken:
When the formatRange
method is called with an arguments startDate and endDate, the following steps are taken:
When the formatRangeToParts
method is called with arguments startDate and endDate, the following steps are taken:
This function provides access to the locale and formatting options computed during initialization of the object.
Internal Slot | Property | Conversion | Location |
---|---|---|---|
[[Locale]] | |||
[[Calendar]] | |||
[[NumberingSystem]] | |||
[[TimeZone]] | |||
[[DateStyle]] | |||
[[TimeStyle]] |
For web compatibility reasons, if the property
Intl.DateTimeFormat instances are
Intl.DateTimeFormat instances have an [[InitializedDateTimeFormat]] internal slot.
Intl.DateTimeFormat instances also have several internal slots that are computed by the
Finally, Intl.DateTimeFormat instances have a [[BoundFormat]] internal slot that caches the function returned by the format accessor (
The abstract operation CalendarEra takes arguments calendar (an Object) and dateLike (a Temporal.PlainDateTime, Temporal.PlainDate, or Temporal.PlainYearMonth) and returns either a era()
method and validates the result. It performs the following steps when called:
The abstract operation CalendarEraYear takes arguments calendar (an Object) and dateLike (a Temporal.PlainDateTime, Temporal.PlainDate, or Temporal.PlainYearMonth) and returns either a eraYear()
method and validates the result. It performs the following steps when called:
The
Like
The abstract operation CalendarMonthDayToISOReferenceDate takes arguments calendar (a String), fields (an ordinary Object for which the value of the [[Prototype]] internal slot is
The fields of the returned
Like { monthCode: "M01", day: "32" }
and { "year": 2001, "month": 2, "day": 29 }
would both cause a
The
The abstract operation CalendarDateDifference takes arguments calendar (a String), one (a Temporal.PlainDate), two (a Temporal.PlainDate), and largestUnit (a String). It performs
The abstract operation CalendarDateEra takes arguments calendar (a String) and date (a Temporal.PlainDateTime, Temporal.PlainDate, or Temporal.PlainYearMonth). It performs
The abstract operation CalendarDateEraYear takes arguments calendar (a String) and date (a Temporal.PlainDateTime, Temporal.PlainDate, or Temporal.PlainYearMonth). It performs
The abstract operation CalendarDateYear takes arguments calendar (a String) and date (a Temporal.PlainDateTime, Temporal.PlainDate, or Temporal.PlainYearMonth). It performs
The abstract operation CalendarDateMonth takes arguments calendar (a String) and date (a Temporal.PlainDateTime, Temporal.PlainDate, Temporal.PlainYearMonth, or Temporal.PlainMonthDay). It performs
The abstract operation CalendarDateMonthCode takes arguments calendar (a String) and date (a Temporal.PlainDateTime, Temporal.PlainDate, Temporal.PlainYearMonth, or Temporal.PlainMonthDay). It performs
The abstract operation CalendarDateDay takes arguments calendar (a String) and date (a Temporal.PlainDateTime, Temporal.PlainDate, or Temporal.PlainMonthDay). It performs
The abstract operation CalendarDateDayOfWeek takes arguments calendar (a String) and date (a Temporal.PlainDateTime or Temporal.PlainDate). It takes a date-like object date and returns the day of the week in the calendar represented by calendar. The return value should be 1-based, where 1 is the day corresponding to Monday in the given calendar.
The abstract operation CalendarDateDayOfYear takes arguments calendar (a String) and date (a Temporal.PlainDateTime or Temporal.PlainDate). It takes a date-like object date and returns the day of the year in the calendar represented by calendar. The return value should be 1-based.
The abstract operation CalendarDateWeekOfYear takes arguments calendar (a String) and date (a Temporal.PlainDateTime or Temporal.PlainDate) and returns a
The value in the [[Week]] field should be 1-based.
The value in the [[Year]] field is relative to the first day of a calendar-specific "
Usually the [[Year]] field will contain the same value given by
It returns
More details about this function will be specified in the Intl era and monthCode proposal.
The abstract operation CalendarDateDaysInWeek takes arguments calendar (a String) and date (a Temporal.PlainDateTime or Temporal.PlainDate). It takes a date-like object date and returns the number of days in the given week in the calendar represented by calendar.
The abstract operation CalendarDateDaysInMonth takes arguments calendar (a String) and date (a Temporal.PlainDateTime, Temporal.PlainDate or Temporal.PlainYearMonth). It identifies the month in the specified calendar that contains date and returns the number of days in that month.
The abstract operation CalendarDateDaysInYear takes arguments calendar (a String) and date (a Temporal.PlainDateTime, Temporal.PlainDate or Temporal.PlainYearMonth). It takes a date-like object date and returns the number of days in the given year in the calendar represented by calendar.
The abstract operation CalendarDateMonthsInYear takes arguments calendar (a String) and date (a Temporal.PlainDateTime, Temporal.PlainDate or Temporal.PlainYearMonth). It takes a date-like object date and returns the number of months in the given year in the calendar represented by calendar.
The abstract operation CalendarDateInLeapYear takes arguments calendar (a String) and date (a Temporal.PlainDateTime, Temporal.PlainDate or Temporal.PlainYearMonth). It takes a date-like object date and returns
The
The abstract operation CalendarFieldKeysToIgnore takes arguments calendar (a String) and keys (a
This operation is relevant for calendars which accept fields other than the standard set of ISO 8601 calendar fields, in order to implement the Temporal objects' with()
methods, and Temporal.Calendar.prototype.mergeFields()
in such a way that the result is free of ambiguity or conflicts.
For example, given a calendar that uses eras, such as with()
method might conflict with either of the other two properties on the receiver object, so those properties of the receiver object should be ignored.
Given this, in addition to the ISO 8601 mutual exclusion of
keys | Returned |
---|---|
« |
« |
« |
« |
« |
« |
« |
« |
« |
« |
« |
« |
« |
« |
The abstract operation CalendarResolveFields takes arguments calendar (a String), fields (an Object), and type (
The operation throws a
This definition supersedes the definition provided in
This method performs the following steps when called:
This definition supersedes the definition provided in
This method performs the following steps when called:
This definition supersedes the definition provided in
This method performs the following steps when called:
This definition supersedes the definition provided in
This method performs the following steps when called:
This definition supersedes the definition provided in
This method performs the following steps when called:
This method performs the following steps when called:
This method performs the following steps when called:
This definition supersedes the definition provided in
This method performs the following steps when called:
This definition supersedes the definition provided in
This method performs the following steps when called:
This definition supersedes the definition provided in
This method performs the following steps when called:
This definition supersedes the definition provided in
This method performs the following steps when called:
This definition supersedes the definition temporalDateLike in
This method performs the following steps when called:
This definition supersedes the definition provided in
This method performs the following steps when called:
This definition supersedes the definition provided in
This method performs the following steps when called:
This definition supersedes the definition provided in
This method performs the following steps when called:
This definition supersedes the definition provided in
This method performs the following steps when called:
This definition supersedes the definition provided in
This method performs the following steps when called:
This definition supersedes the definition provided in
This method performs the following steps when called:
This definition supersedes the definition provided in
This method performs the following steps when called:
This definition supersedes the definition provided in
This method performs the following steps when called:
This definition supersedes the definition provided in
This method performs the following steps when called:
This definition supersedes the definition provided in
This method performs the following steps when called:
This function is currently not specified. See the Intl.DurationFormat proposal.
This definition supersedes the definition provided in
This method performs the following steps when called:
This definition supersedes the definition provided in
This method performs the following steps when called:
Temporal.PlainDate.prototype.era
is an
Temporal.PlainDate.prototype.eraYear
is an
This definition supersedes the definition provided in
This method performs the following steps when called:
Temporal.PlainDate.prototype.era
is an
Temporal.PlainDateTime.prototype.eraYear
is an
This definition supersedes the definition provided in
This method performs the following steps when called:
This definition supersedes the definition provided in
This method performs the following steps when called:
This definition supersedes the definition provided in
This method performs the following steps when called:
Temporal.PlainYearMonth.prototype.era
is an
Temporal.PlainYearMonth.prototype.eraYear
is an
This definition supersedes the definition provided in
This method performs the following steps when called:
Temporal.ZonedDateTime.prototype.era
is an
Temporal.ZonedDateTime.prototype.eraYear
is an
© 2024 Maggie Pint, Matt Johnson, Brian Terlson, Daniel Ehrenberg, Philipp Dunkel, Sasha Pierson, Ujjwal Sharma, Philip Chimento, Justin Grant
All Software contained in this document ("Software") is protected by copyright and is being made available under the "BSD License", included below. This Software may be subject to third party rights (rights from parties other than Ecma International), including patent rights, and no licenses under such third party rights are granted under this license even if the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS AVAILABLE AT https://ecma-international.org/memento/codeofconduct.htm FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.