The Temporal Object

The Temporal object:

Value Properties of the Temporal Object

Temporal [ %Symbol.toStringTag% ]

The initial value of the %Symbol.toStringTag% property is the String value *"Temporal"*.

This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.

Constructor Properties of the Temporal Object

Temporal.Instant ( . . . )

See .

Temporal.PlainDateTime ( . . . )

See .

Temporal.PlainDate ( . . . )

See .

Temporal.PlainTime ( . . . )

See .

Temporal.PlainYearMonth ( . . . )

See .

Temporal.PlainMonthDay ( . . . )

See .

Temporal.Duration ( . . . )

See .

Temporal.ZonedDateTime ( . . . )

See .

Other Properties of the Temporal Object

Temporal.Now

See .

The Temporal.Now Object

The Temporal.Now object:

Value Properties of the Temporal.Now Object

Temporal.Now [ %Symbol.toStringTag% ]

The initial value of the %Symbol.toStringTag% property is the String value *"Temporal.Now"*.

This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.

Function Properties of the Temporal.Now Object

Temporal.Now.timeZoneId ( )

This function performs the following steps when called:

1. Return SystemTimeZoneIdentifier().

Temporal.Now.instant ( )

This function performs the following steps when called:

1. Let _ns_ be SystemUTCEpochNanoseconds(). 1. Return ! CreateTemporalInstant(_ns_).

Temporal.Now.plainDateTimeISO ( [ _temporalTimeZoneLike_ ] )

This function performs the following steps when called:

1. Let _isoDateTime_ be ? SystemDateTime(_temporalTimeZoneLike_). 1. Return ! CreateTemporalDateTime(_isoDateTime_, *"iso8601"*).

Temporal.Now.zonedDateTimeISO ( [ _temporalTimeZoneLike_ ] )

This function performs the following steps when called:

1. If _temporalTimeZoneLike_ is *undefined*, then 1. Let _timeZone_ be SystemTimeZoneIdentifier(). 1. Else, 1. Let _timeZone_ be ? ToTemporalTimeZoneIdentifier(_temporalTimeZoneLike_). 1. Let _ns_ be SystemUTCEpochNanoseconds(). 1. Return ! CreateTemporalZonedDateTime(_ns_, _timeZone_, *"iso8601"*).

Temporal.Now.plainDateISO ( [ _temporalTimeZoneLike_ ] )

This function performs the following steps when called:

1. Let _isoDateTime_ be ? SystemDateTime(_temporalTimeZoneLike_). 1. Return ! CreateTemporalDate(_isoDateTime_.[[ISODate]], *"iso8601"*).

Temporal.Now.plainTimeISO ( [ _temporalTimeZoneLike_ ] )

This function performs the following steps when called:

1. Let _isoDateTime_ be ? SystemDateTime(_temporalTimeZoneLike_). 1. Return ! CreateTemporalTime(_isoDateTime_.[[Time]]).

Abstract Operations

HostSystemUTCEpochNanoseconds ( _global_: a global object, ): an integer

description
It allows host environments to reduce the precision of the result. In particular, web browsers artificially limit it to prevent abuse of security flaws (e.g., Spectre) and to avoid certain methods of fingerprinting.

An implementation of HostSystemUTCEpochNanoseconds must conform to the following requirements:

  • Its result must be between nsMinInstant and nsMaxInstant.

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:

1. Let _ns_ be the approximate current UTC date and time, in nanoseconds since the epoch. 1. Return the result of clamping _ns_ between nsMinInstant and nsMaxInstant.

ECMAScript hosts that are not web browsers must use the default implementation of HostSystemUTCEpochNanoseconds.

SystemUTCEpochMilliseconds ( ): a Number

description
1. Let _global_ be GetGlobalObject(). 1. Let _nowNs_ be HostSystemUTCEpochNanoseconds(_global_). 1. Return 𝔽(floor(_nowNs_ / 106)).

SystemUTCEpochNanoseconds ( ): a BigInt

description
1. Let _global_ be GetGlobalObject(). 1. Let _nowNs_ be HostSystemUTCEpochNanoseconds(_global_). 1. Return ℤ(_nowNs_).

SystemDateTime ( _temporalTimeZoneLike_: an ECMAScript language value, ): either a normal completion containing an ISO Date-Time Record or a throw completion

description
1. If _temporalTimeZoneLike_ is *undefined*, then 1. Let _timeZone_ be SystemTimeZoneIdentifier(). 1. Else, 1. Let _timeZone_ be ? ToTemporalTimeZoneIdentifier(_temporalTimeZoneLike_). 1. Let _epochNs_ be SystemUTCEpochNanoseconds(). 1. Return GetISODateTimeFor(_timeZone_, _epochNs_).