TemporalZ

Instant

The Temporal.Instant object represents a unique point in time, with nanosecond precision. It is fundamentally represented as the number of nanoseconds since the Unix epoch (midnight at the beginning of January 1, 1970, UTC), without any time zone or calendar system.

See: Temporal.Instant

Fields

#
_inner:*abi.c.Instant
*abi.c.Instant

Types

#
ToStringOptions

Options for Instant.toString().

Functions

#
init

Construct an Instant from epoch nanoseconds (Temporal.Instant.fromEpochNanoseconds).

fromEpochMilliseconds

Construct an Instant from epoch milliseconds (Temporal.Instant.fromEpochMilliseconds).

fromEpochNanoseconds

Construct an Instant from epoch nanoseconds (Temporal.Instant.fromEpochNanoseconds).

from

Parse an RFC 9557 string (Temporal.Instant.from) or from another Temporal.Instant.

add

Returns a new Instant representing this instant moved forward by a given Duration.

subtract

Returns a new Instant representing this instant moved backward by a given Duration.

until

Returns a Duration representing the difference from this instant until another instant.

since

Returns a Duration representing the difference from another instant until this instant.

round

Returns a new Instant rounded to the given unit.

compare

Compares two Instants, returning -1, 0, or 1 if the first is before, equal, or after the second.

equals

Returns true if two Instants are equal (same epoch nanoseconds).

toString

Returns a string representing this instant in the RFC 9557 format, optionally using a time zone.

toJSON

Returns a string representing this instant in the RFC 9557 format (same as toString). Intended for JSON serialization.

toLocaleString

Returns a string with a language-sensitive representation of this instant.

toZonedDateTimeISO

Returns a ZonedDateTime representing this instant in the specified time zone using the ISO 8601 calendar system.

epochMilliseconds

Returns the number of milliseconds since the Unix epoch for this instant.

epochNanoseconds

Returns the number of nanoseconds since the Unix epoch for this instant.

deinit

Deinitialize the Instant, freeing underlying resources.

Aliases

#
Unit

Units supported by Temporal.Instant (e.g., nanosecond, microsecond, millisecond, second, minute, hour).

RoundingMode

Rounding modes for Instant operations.

Sign

The sign of a Duration: positive, zero, or negative.

RoundingOptions

Options for rounding an Instant.

DifferenceSettings

Options for difference calculations between Instants.

TimeZone

Time zone identifier or object for use with toString and toZonedDateTimeISO.