?
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
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:
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
The abstract operation SystemUTCEpochMilliseconds takes no arguments and returns a Number. It performs the following steps when called:
The abstract operation SystemUTCEpochNanoseconds takes no arguments and returns a BigInt. It performs the following steps when called:
The abstract operation SystemDateTime takes argument temporalTimeZoneLike (an
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.era
is an
Temporal.PlainDate.prototype.eraYear
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:
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 always throws, because in the absence of valueOf()
, expressions with arithmetic operators such as plainDate1 > plainDate2
would fall back to being equivalent to plainDate1.toString() > plainDate2.toString()
.
Lexicographical comparison of serialized strings might not seem obviously wrong, because the result would sometimes be correct.
Implementations are encouraged to phrase the error message to point users to Temporal.PlainDate.compare()
, Temporal.PlainDate.prototype.equals()
, and/or Temporal.PlainDate.prototype.toString()
.
Temporal.PlainDate instances are
Internal Slot | Description |
---|---|
[[InitializedTemporalDate]] | The only specified use of this slot is for distinguishing Temporal.PlainDate instances from other objects. |
[[ISODate]] |
An |
[[Calendar]] |
A |
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 isoDate (an
The abstract operation ToTemporalDate takes argument item (an
The abstract operation ISODateSurpasses takes arguments sign (-1 or 1), y1 (an
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 PadISOYear takes argument y (an
The abstract operation TemporalDateToString takes arguments temporalDate (a Temporal.PlainDate) and showCalendar (
The abstract operation ISODateWithinLimits takes argument isoDate (an Temporal.PlainDate
, and
Deferring to
It performs the following steps when called:
The abstract operation CompareISODate takes arguments isoDate1 (an
The abstract operation DifferenceTemporalPlainDate takes arguments operation (
The abstract operation AddDurationToDate 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:
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 always throws, because in the absence of valueOf()
, expressions with arithmetic operators such as plainTime1 > plainTime2
would fall back to being equivalent to plainTime1.toString() > plainTime2.toString()
.
Lexicographical comparison of serialized strings might not seem obviously wrong, because the result would sometimes be correct.
Implementations are encouraged to phrase the error message to point users to Temporal.PlainTime.compare()
, Temporal.PlainTime.prototype.equals()
, and/or Temporal.PlainTime.prototype.toString()
.
Temporal.PlainTime instances are
Internal Slot | Description |
---|---|
[[InitializedTemporalTime]] | The only specified use of this slot is for distinguishing Temporal.PlainTime instances from other objects. |
[[Time]] |
A |
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 CreateTimeRecord takes arguments hour (an
The abstract operation MidnightTimeRecord takes no arguments and returns a
The abstract operation NoonTimeRecord takes no arguments and returns a
The abstract operation DifferenceTime takes arguments time1 (a
The abstract operation ToTemporalTime takes argument item (an
The abstract operation ToTimeRecordOrMidnight takes argument item (an
The abstract operation RegulateTime takes arguments hour (an
The abstract operation IsValidTime takes arguments hour (an
The abstract operation BalanceTime takes arguments hour (an
The abstract operation CreateTemporalTime takes argument time (a
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 TimeRecordToString takes arguments time (a
The abstract operation CompareTimeRecord takes arguments time1 (a
The abstract operation AddTime takes arguments time (a
The abstract operation RoundTime takes arguments time (a
The abstract operation DifferenceTemporalPlainTime takes arguments operation (
The abstract operation AddDurationToTime 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.PlainDate.prototype.era
is an
Temporal.PlainDateTime.prototype.eraYear
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:
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 always throws, because in the absence of valueOf()
, expressions with arithmetic operators such as plainDateTime1 > plainDateTime2
would fall back to being equivalent to plainDateTime1.toString() > plainDateTime2.toString()
.
Lexicographical comparison of serialized strings might not seem obviously wrong, because the result would sometimes be correct.
Implementations are encouraged to phrase the error message to point users to Temporal.PlainDateTime.compare()
, Temporal.PlainDateTime.prototype.equals()
, and/or Temporal.PlainDateTime.prototype.toString()
.
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. |
[[ISODateTime]] |
An |
[[Calendar]] |
A |
An ISO Date-Time Record is a
ISO Date-Time Records have the fields listed in
Field Name | Value | Meaning |
---|---|---|
[[ISODate]] | an |
The date in the ISO 8601 calendar. |
[[Time]] | a |
The time. The [[Days]] field is ignored. |
The abstract operation TimeValueToISODateTimeRecord takes argument t (a
The abstract operation CombineISODateAndTimeRecord takes arguments isoDate (an
The abstract operation ISODateTimeWithinLimits takes argument isoDateTime (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 calendar (a
The abstract operation ToTemporalDateTime takes argument item (an
The abstract operation BalanceISODateTime takes arguments year (an
The abstract operation CreateTemporalDateTime takes arguments isoDateTime (an
The abstract operation ISODateTimeToString takes arguments isoDateTime (an
The abstract operation CompareISODateTime takes arguments isoDateTime1 (an
The abstract operation RoundISODateTime takes arguments isoDateTime (an
The abstract operation DifferenceISODateTime takes arguments isoDateTime1 (an
The abstract operation DifferencePlainDateTimeWithRounding takes arguments isoDateTime1 (an
The abstract operation DifferencePlainDateTimeWithTotal takes arguments isoDateTime1 (an
The abstract operation DifferenceTemporalPlainDateTime takes arguments operation (
The abstract operation AddDurationToDateTime 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.era
is an
Temporal.ZonedDateTime.prototype.eraYear
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.epochMilliseconds
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:
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 always throws, because in the absence of valueOf()
, expressions with arithmetic operators such as zonedDateTime1 > zonedDateTime2
would fall back to being equivalent to zonedDateTime1.toString() > zonedDateTime2.toString()
.
Lexicographical comparison of serialized strings might not seem obviously wrong, because the result would sometimes be correct.
Implementations are encouraged to phrase the error message to point users to Temporal.ZonedDateTime.compare()
, Temporal.ZonedDateTime.prototype.equals()
, and/or Temporal.ZonedDateTime.prototype.toString()
.
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. |
[[EpochNanoseconds]] |
A BigInt value representing the number of nanoseconds since the |
[[TimeZone]] |
An |
[[Calendar]] |
A |
The abstract operation InterpretISODateTimeOffset takes arguments isoDate (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 (an
The abstract operation TemporalZonedDateTimeToString takes arguments zonedDateTime (a Temporal.ZonedDateTime), precision (
The abstract operation AddZonedDateTime takes arguments epochNanoseconds (a BigInt), timeZone (an
The abstract operation DifferenceZonedDateTime takes arguments ns1 (a BigInt), ns2 (a BigInt), timeZone (an
The abstract operation DifferenceZonedDateTimeWithRounding takes arguments ns1 (a BigInt), ns2 (a BigInt), timeZone (an
The abstract operation DifferenceZonedDateTimeWithTotal takes arguments ns1 (a BigInt), ns2 (a BigInt), timeZone (an
The abstract operation DifferenceTemporalZonedDateTime takes arguments operation (
The abstract operation AddDurationToZonedDateTime 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:
The Temporal.Duration.prototype.total
method performs the following steps when called:
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:
This method always throws, because in the absence of valueOf()
, expressions with arithmetic operators such as duration1 > duration2
would fall back to being equivalent to duration1.toString() > duration2.toString()
.
Lexicographical comparison of serialized strings might not seem obviously wrong, because the result would sometimes be correct.
Implementations are encouraged to phrase the error message to point users to Temporal.Duration.compare()
and/or Temporal.Duration.prototype.toString()
.
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 Date Duration Record is a
Date 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. |
A partial Duration Record is a
Partial 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. |
[[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 Internal Duration Record is a
A time duration is an
Internal Duration Records have the fields listed in
Field Name | Value | Meaning |
---|---|---|
[[Date]] | a |
The date portion of the duration. |
[[Time]] | a |
The time portion of the duration. |
The abstract operation ZeroDateDuration takes no arguments and returns a
The abstract operation ToInternalDurationRecord takes argument duration (a Temporal.Duration) and returns an
The abstract operation ToInternalDurationRecordWith24HourDays takes argument duration (a Temporal.Duration) and returns an
The abstract operation ToDateDurationRecordWithoutTime takes argument duration (a Temporal.Duration) and returns either a
The abstract operation TemporalDurationFromInternal takes arguments internalDuration (an Temporal.Duration
object, with each component stored separately.
The time units are balanced up to largestUnit.
The conversion may be lossy if largestUnit is
std::fma()
. String manipulation will also give an exact result, since the multiplication is by a power of 10.The abstract operation CreateDateDurationRecord takes arguments years (an
The abstract operation AdjustDateDurationRecord takes arguments dateDuration (a
The abstract operation CombineDateAndTimeDuration takes arguments dateDuration (a
The abstract operation ToTemporalDuration takes argument item (an
The abstract operation DurationSign takes argument duration (a Temporal.Duration) and returns -1, 0, or 1. It returns 1 if the most significant non-zero field in the duration argument is positive, and -1 if the most significant non-zero field is negative. If all of duration's fields are zero, it returns 0. It performs the following steps when called:
The abstract operation DateDurationSign takes argument dateDuration (a
The abstract operation InternalDurationSign takes argument internalDuration (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 argument duration (a Temporal.Duration) and returns a Temporal.Duration.prototype.round()
method and elsewhere, where the largestUnit
option, if not given explicitly, is set to the largest-magnitude non-zero unit. 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) and returns 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 TimeDurationFromComponents takes arguments hours (an
The abstract operation AddTimeDuration takes arguments one (a
The abstract operation Add24HourDaysToTimeDuration takes arguments d (a
The abstract operation AddTimeDurationToEpochNanoseconds takes arguments d (a
The abstract operation CompareTimeDuration takes arguments one (a
The abstract operation DivideTimeDuration takes arguments d (a
__float128
type if the compiler supports it, or with software emulation such as in the SoftFP library.The abstract operation TimeDurationFromEpochNanosecondsDifference takes arguments one (a BigInt) and two (a BigInt) and returns a
The abstract operation RoundTimeDurationToIncrement takes arguments d (a
The abstract operation TimeDurationSign takes argument d (a
The abstract operation DateDurationDays takes arguments dateDuration (a
The abstract operation RoundTimeDuration takes arguments timeDuration (a
The abstract operation TotalTimeDuration takes arguments timeDuration (a
A Duration Nudge Result Record is a
Duration Nudge Result Records have the fields listed in
Field Name | Value | Meaning |
---|---|---|
[[Duration]] | an |
The resulting duration. |
[[NudgedEpochNs]] | a BigInt |
The |
[[DidExpandCalendarUnit]] | a Boolean | Whether the rounding operation caused the duration to expand to the next day or larger unit. |
The abstract operation NudgeToCalendarUnit takes arguments sign (-1 or 1), duration (an
The abstract operation NudgeToZonedTime takes arguments sign (-1 or 1), duration (an Temporal.ZonedDateTime
starting point, accounting for the case where the rounding causes the time to exceed the total time within a day, which may be influenced by UTC offset changes in the time zone.
It performs the following steps when called:
The abstract operation NudgeToDayOrTime takes arguments duration (an
The abstract operation BubbleRelativeDuration takes arguments sign (-1 or 1), duration (an
The abstract operation RoundRelativeDuration takes arguments duration (an
The abstract operation TotalRelativeDuration takes arguments duration (an
The abstract operation TemporalDurationToString takes arguments duration (a Temporal.Duration) and precision (an
The abstract operation AddDurations 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:
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.epochMilliseconds
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 always throws, because in the absence of valueOf()
, expressions with arithmetic operators such as instant1 > instant2
would fall back to being equivalent to instant1.toString() > instant2.toString()
.
Lexicographical comparison of serialized strings might not seem obviously wrong, because the result would sometimes be correct.
Implementations are encouraged to phrase the error message to point users to Temporal.Instant.compare()
, Temporal.Instant.prototype.equals()
, and/or Temporal.Instant.prototype.toString()
.
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. |
[[EpochNanoseconds]] |
A BigInt value representing the number of nanoseconds since the |
The [[EpochNanoseconds]] 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 takes argument epochNanoseconds (a BigInt) and returns a Boolean. It returns
The abstract operation CreateTemporalInstant takes argument epochNanoseconds (a BigInt) and optional argument newTarget (a
The abstract operation ToTemporalInstant takes argument item (an
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 timeDuration (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 TemporalInstantToString takes arguments instant (a Temporal.Instant), timeZone (an Z
if timeZone is
The abstract operation DifferenceTemporalInstant takes arguments operation (
The abstract operation AddDurationToInstant 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.era
is an
Temporal.PlainYearMonth.prototype.eraYear
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 always throws, because in the absence of valueOf()
, expressions with arithmetic operators such as plainYearMonth1 > plainYearMonth2
would fall back to being equivalent to plainYearMonth1.toString() > plainYearMonth2.toString()
.
Lexicographical comparison of serialized strings might not seem obviously wrong, because the result would sometimes be correct.
Implementations are encouraged to phrase the error message to point users to Temporal.PlainYearMonth.compare()
, Temporal.PlainYearMonth.prototype.equals()
, and/or Temporal.PlainYearMonth.prototype.toString()
.
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. |
[[ISODate]] |
An |
[[Calendar]] |
A |
An ISO Year-Month Record is a
ISO Year-Month 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. |
The abstract operation ToTemporalYearMonth takes argument item (an
The abstract operation ISOYearMonthWithinLimits takes argument isoDate (an
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 BalanceISOYearMonth takes arguments year (an
The abstract operation CreateTemporalYearMonth takes arguments isoDate (an
The abstract operation TemporalYearMonthToString takes arguments yearMonth (a Temporal.PlainYearMonth) and showCalendar (
The abstract operation DifferenceTemporalPlainYearMonth takes arguments operation (
The abstract operation AddDurationToYearMonth 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 always throws, because in the absence of valueOf()
, expressions with arithmetic operators such as plainMonthDay1 > plainMonthDay2
would fall back to being equivalent to plainMonthDay1.toString() > plainMonthDay2.toString()
.
Lexicographical comparison of serialized strings might not seem obviously wrong, because the result would sometimes be correct.
Implementations are encouraged to phrase the error message to point users to Temporal.PlainDate.compare()
on the corresponding PlainDate
objects, Temporal.PlainMonthDay.prototype.equals()
, and/or Temporal.PlainMonthDay.prototype.toString()
.
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. |
[[ISODate]] |
An |
[[Calendar]] |
A |
The abstract operation ToTemporalMonthDay takes argument item (an
The abstract operation CreateTemporalMonthDay takes arguments isoDate (an
The abstract operation TemporalMonthDayToString takes arguments monthDay (a Temporal.MonthDay) and showCalendar (
The abstract operation GetAvailableNamedTimeZoneIdentifier takes argument timeZoneIdentifier (a named
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 ToTemporalTimeZoneIdentifier takes argument temporalTimeZoneLike (an ECMAScript value) and returns either a
The abstract operation GetOffsetNanosecondsFor takes arguments timeZone (an
The abstract operation GetISODateTimeFor takes arguments timeZone (an
It performs the following steps when called:
The abstract operation GetEpochNanosecondsFor takes arguments timeZone (an
It performs the following steps when called:
The abstract operation DisambiguatePossibleEpochNanoseconds takes arguments possibleEpochNs (a
The abstract operation GetPossibleEpochNanoseconds takes arguments timeZone (an
The abstract operation GetStartOfDay takes arguments timeZone (an
The abstract operation TimeZoneEquals takes arguments one (an
The abstract operation ParseTimeZoneIdentifier takes argument identifier (a String) and returns either a
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).
The abstract operation CanonicalizeCalendar takes argument id (a String) and returns either a
The
An Calendar Date Record is a
Calendar Date Records have the fields listed in
Field Name | Value | Meaning |
---|---|---|
[[Era]] | a String or |
A lowercase String value representing the date's era, or |
[[EraYear]] | an |
The ordinal position of the date's year within its era, or
Era years are 1-indexed for many calendars, but not all (e.g., the eras of the Burmese calendar each start with a year 0). Years can also advance opposite the flow of time (as for BCE years in the Gregorian calendar).
|
[[Year]] | an |
The date's year relative to the first day of a calendar-specific " |
[[Month]] | a positive |
The 1-based ordinal position of the date's month within its year.
When the number of months in a year of the calendar is variable, a different value can be returned for dates that are part of the same month in different years. For example, in the Hebrew calendar, 1 Nisan 5781 is associated with value 7 while 1 Nisan 5782 is associated with value 8 because 5782 is a leap year and Nisan follows the insertion of Adar I.
|
[[MonthCode]] | a String |
The month code of the date's month. The month code for a month that is not a leap month and whose 1-based ordinal position in a common year of the calendar (i.e., a year that is not a leap year) is n should be the
For example, in the Hebrew calendar, the month code of Adar (and Adar II, in leap years) is |
[[Day]] | a positive |
The 1-based ordinal position of the date's day within its month. |
[[DayOfWeek]] | a positive |
The day of the week corresponding to the date. The value should be 1-based, where 1 is the day corresponding to Monday in the given calendar. |
[[DayOfYear]] | a positive |
The 1-based ordinal position of the date's day within its year. |
[[WeekOfYear]] | a |
The date's calendar week of year, and the corresponding week calendar year. The The
Usually the The More details about this field will be specified in the Intl era and monthCode proposal. |
[[DaysInWeek]] | a positive |
The number of days in the date's week. |
[[DaysInMonth]] | a positive |
The number of days in the date's month. |
[[DaysInYear]] | a positive |
The number of days in the date's year. |
[[MonthsInYear]] | a positive |
The number of months in the date's year. |
[[InLeapYear]] | a Boolean |
A "leap year" is a year that contains more days than other years (for solar or lunar calendars) or more months than other years (for lunisolar calendars like Hebrew or Chinese).
Some calendars, especially lunisolar ones, have further variation in year length that is not represented in the output of this operation (e.g., the Hebrew calendar includes common years with 353, 354, or 355 days and leap years with 383, 384, or 385 days).
|
An Calendar Fields Record is a
Many of the fields in a Calendar Fields Record have the same meaning as the fields of the same name in
Each field has a corresponding Temporal.PlainDate.prototype.with()
.
Each field has a corresponding enumeration key.
Calendar Fields Records have the fields listed in
Field Name | Value | Default | Property Key | Enumeration Key | Conversion | Meaning |
---|---|---|---|---|---|---|
[[Era]] | a String or |
A lowercase String value representing the era. | ||||
[[EraYear]] | an |
The ordinal position of the year within the era. | ||||
[[Year]] | an |
The year relative to the first day of a calendar-specific " |
||||
[[Month]] | a positive |
The 1-based ordinal position of the month within the year. | ||||
[[MonthCode]] | a String or |
The month code of the month. | ||||
[[Day]] | a positive |
The 1-based ordinal position of the day within the month. | ||||
[[Hour]] | an |
0 | The number of the hour within the day. | |||
[[Minute]] | an |
0 | The number of the minute within the hour. | |||
[[Second]] | an |
0 | The number of the second within the minute. | |||
[[Millisecond]] | an |
0 | The number of the millisecond within the second. | |||
[[Microsecond]] | an |
0 | The number of the microsecond within the millisecond. | |||
[[Nanosecond]] | an |
0 | The number of the nanosecond within the microsecond. | |||
[[OffsetString]] | a String or |
A string of the form ±HH:MM[:SS.SSSSSSSSS] that can be parsed by |
||||
[[TimeZone]] | a String or |
A |
The abstract operation PrepareCalendarFields takes arguments calendar (a
The abstract operation CalendarFieldKeysPresent takes argument fields (a
The abstract operation CalendarMergeFields takes arguments calendar (a
The
When calendar is not
The
The abstract operation ToTemporalCalendarIdentifier takes argument temporalCalendarLike (an ECMAScript value) and returns either a
The abstract operation GetTemporalCalendarIdentifierWithISODefault takes argument item (an Object) and returns either a calendar
property on the given item and converts its value into a calendar identifier.
If no such property is present, the built-in ISO 8601 calendar is returned.
It performs the following steps when called:
The abstract operation CalendarDateFromFields takes arguments calendar (a
The abstract operation CalendarYearMonthFromFields takes arguments calendar (a
The abstract operation CalendarMonthDayFromFields takes arguments calendar (a
The abstract operation FormatCalendarAnnotation takes arguments id (a
The abstract operation CalendarEquals takes arguments one (a
The abstract operation ISODaysInMonth takes arguments year (an
The abstract operation ISOWeekOfYear takes argument isoDate (an
The abstract operation ISODayOfYear takes argument isoDate (an
The abstract operation ISODayOfWeek takes argument isoDate (an
The
Like
The
The fields of the returned
Like
Also like
The operation throws a
The
Implementations are encouraged to elide fields that are not read by the caller.
The
The
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 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
The operation throws a
When the fields of fields are inconsistent with respect to a non-
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 CheckISODaysRange takes argument isoDate (an
Time is reckoned using multiple units.
These units are listed in
A Temporal unit is a value listed in the "Value" column of
Value | Singular |
Plural |
Category | Length in nanoseconds | Maximum duration rounding increment |
---|---|---|---|---|---|
calendar-dependent | |||||
calendar-dependent | |||||
calendar-dependent | |||||
3.6 × 1012 | 24 | ||||
6 × 1010 | 60 | ||||
109 | 60 | ||||
106 | 1000 | ||||
103 | 1000 | ||||
1 | 1000 |
Temporal.ZonedDateTime
.
The abstract operation GetTemporalOverflowOption takes argument options (an Object) and returns either a
The abstract operation GetTemporalDisambiguationOption takes argument options (an Object) and returns either a
The abstract operation NegateRoundingMode takes argument roundingMode (a
The abstract operation GetTemporalOffsetOption takes arguments options (an Object) and fallback (
The abstract operation GetTemporalShowCalendarNameOption takes argument options (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 GetTemporalShowTimeZoneNameOption takes argument options (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 GetTemporalShowOffsetOption takes argument options (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 GetDirectionOption takes argument options (an Object) and returns either a
The abstract operation ValidateTemporalRoundingIncrement takes arguments increment (a positive
The abstract operation GetTemporalFractionalSecondDigitsOption takes argument options (an Object) and returns either a
The abstract operation ToSecondsStringPrecisionRecord takes arguments smallestUnit (
The abstract operation GetTemporalUnitValuedOption takes arguments options (an Object), key (a
Both singular and plural unit names are accepted, but only the singular form is used internally.
The abstract operation GetTemporalRelativeToOption takes argument options (an Object) and returns either a relativeTo
property of its options argument.
If the value is
The abstract operation LargerOfTwoTemporalUnits takes arguments u1 (a
The abstract operation IsCalendarUnit takes argument unit (a
The abstract operation TemporalUnitCategory takes argument unit (a
The abstract operation MaximumTemporalDurationRoundingIncrement takes argument unit (a
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 (an
The abstract operation GetUnsignedRoundingMode takes arguments roundingMode (a
Rounding Mode | 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.
The
The
A ISO String Time Zone Parse Record is a
ISO String Time Zone Parse Records have the fields listed in
Field Name | Value | Meaning |
---|---|---|
[[Z]] | a Boolean |
Whether the ISO 8601 string contained the Z UTC designator.
|
[[OffsetString]] | a String or |
The UTC offset from the ISO 8601 string, or |
[[TimeZoneAnnotation]] | a String or |
The time zone annotation from the ISO 8601 string, or |
An ISO Date-Time Parse Record is a
For any ISO Date-Time Parse Record r,
ISO Date-Time Parse Records have the fields listed in
Field Name | Value | Meaning |
---|---|---|
[[Year]] | an |
The year in the ISO 8601 calendar, or |
[[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. |
[[Time]] | either a |
The time of day, or |
[[TimeZone]] | an |
A representation of how the time zone was expressed in the ISO 8601 string. |
[[Calendar]] | a String or |
The |
The abstract operation ParseISODateTime takes arguments isoString (a String) and allowedFormats (a
The abstract operation ParseTemporalCalendarString takes argument string (a String) and returns either a
The abstract operation ParseTemporalDurationString takes argument isoString (a String) and returns either a
It performs the following steps when called:
The abstract operation ParseTemporalTimeZoneString takes argument timeZoneString (a String) and returns either 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 ToMonthCode takes argument argument (an
The abstract operation ToOffsetString takes argument argument (an
The abstract operation ISODateToFields takes arguments calendar (a
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 notation “
The mathematical function
[...]
Mathematical functions
[...]
[...]
The abstract operation GetOptionsObject takes argument options (an
The abstract operation GetOption takes arguments options (an Object), property (a
The abstract operation GetRoundingModeOption takes arguments options (an Object) and fallback (a rounding mode) and returns either a
A rounding mode is one of the values in the "Rounding Mode" column of
The following table is taken from ECMA-402 (
Rounding Mode | String 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 GetRoundingIncrementOption takes argument options (an Object) and returns either a
[...]
The abstract operation GetUTCEpochNanoseconds takes arguments year (an , month (an , day (an , hour (an , minute (an , second (an , millisecond (an , microsecond (an , nanosecond (an , and isoDateTime (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.
An available time zone identifier is either an available named time zone identifier or an offset time zone identifier.
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 year (an , month (an , day (an , hour (an , minute (an , second (an , millisecond (an , microsecond (an , nanosecond (an , and isoDateTime (an
When the input represents a local time occurring more than once because of a negative time zone transition (e.g. when daylight saving time ends or the time zone offset is decreased due to a time zone rule change), the returned
The default implementation of GetNamedTimeZoneEpochNanoseconds, to be used for ECMAScript implementations that do not include local political rules for any time zones, performs the following steps when called:
It is required for
1:30 AM on 5 November 2017 in America/New_York is repeated twice, so GetNamedTimeZoneEpochNanoseconds( for that time zone and ISO date-time would return a
2:30 AM on 12 March 2017 in America/New_York does not exist, so GetNamedTimeZoneEpochNanoseconds( for that time zone and ISO date-time would return an empty
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.
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
This specification identifies calendars using a
The abstract operation
[...]
[...]
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
type
[...]
[...]
The value of the [[LocaleData]] internal slot is
The abstract operation GetDateTimeFormat takes arguments formats (a
The abstract operation AdjustDateTimeStyleFormat takes arguments formats (a "dateStyle"
or "timeStyle"
options.
For example, a locale's best format for "dateStyle": "full"
might include the weekday, which is not applicable when formatting a Temporal.PlainYearMonth
object.
It performs the following steps when called:
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), format (a x (a Number), and epochNanoseconds (a BigInt) and returns a 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
Each Value Format Record has the fields defined in
Field Name | Value Type |
---|---|
[[Format]] | 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 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 options computed during initialization of the object.
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 (
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:
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:
© 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.