Temporal.Instant - Web documentation
class Temporal.Instant
Unstable

A Temporal.Instant is an exact point in time, with a precision in nanoseconds. No time zone or calendar information is present. Therefore, Temporal.Instant has no concept of days, months, or even hours.

For convenience of interoperability, it internally uses nanoseconds since the Unix epoch (midnight UTC on January 1, 1970). However, a Temporal.Instant can be created from any of several expressions that refer to a single point in time, including an ISO 8601 string with a time zone offset such as '2020-01-23T17:04:36.491865121-08:00'.

See https://tc39.es/proposal-temporal/docs/instant.html for more details.

Constructors

new
Instant(epochNanoseconds: bigint)

Properties

readonly
[Symbol.toStringTag]: "Temporal.Instant"
readonly
epochMicroseconds: bigint
readonly
epochMilliseconds: number
readonly
epochNanoseconds: bigint
readonly
epochSeconds: number

Methods

add(durationLike: Omit<Temporal.Duration | DurationLike,
"years"
| "months"
| "weeks"
| "days"
> | string
): Temporal.Instant
equals(other: Temporal.Instant | string): boolean
round(roundTo: RoundTo<
"hour"
| "minute"
| "second"
| "millisecond"
| "microsecond"
| "nanosecond"
>
): Temporal.Instant
since(
other: Temporal.Instant | string,
options?: DifferenceOptions<
"hour"
| "minute"
| "second"
| "millisecond"
| "microsecond"
| "nanosecond"
>
,
): Temporal.Duration
subtract(durationLike: Omit<Temporal.Duration | DurationLike,
"years"
| "months"
| "weeks"
| "days"
> | string
): Temporal.Instant
toJSON(): string
toLocaleString(
locales?: string | string[],
): string
toString(options?: InstantToStringOptions): string
toZonedDateTime(calendarAndTimeZone: { timeZone: TimeZoneLike; calendar: CalendarLike; }): Temporal.ZonedDateTime
until(
other: Temporal.Instant | string,
options?: DifferenceOptions<
"hour"
| "minute"
| "second"
| "millisecond"
| "microsecond"
| "nanosecond"
>
,
): Temporal.Duration
valueOf(): never

Static Methods

fromEpochMicroseconds(epochMicroseconds: bigint): Temporal.Instant
fromEpochMilliseconds(epochMilliseconds: number): Temporal.Instant
fromEpochNanoseconds(epochNanoseconds: bigint): Temporal.Instant
fromEpochSeconds(epochSeconds: number): Temporal.Instant