Instant

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 {@link https://en.wikipedia.org/wiki/Unix_time|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 {@link https://en.wikipedia.org/wiki/ISO_8601|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

Link copied to clipboard
constructor(epochNanoseconds: BigInt)

Types

Link copied to clipboard

Properties

Link copied to clipboard
Link copied to clipboard
external val epochMilliseconds: Int53
Link copied to clipboard
external val epochNanoseconds: BigInt
Link copied to clipboard
external val epochSeconds: Int53

Functions

Link copied to clipboard
open external fun add(duration: Duration, options: ArithmeticOptions = definedExternally): Instant
open external fun add(duration: DurationLike, options: ArithmeticOptions = definedExternally): Instant
open external fun add(duration: String, options: ArithmeticOptions = definedExternally): Instant
Link copied to clipboard
open external fun round(roundTo: RoundTo<TimeUnit<*>>): Instant
open external fun round(roundTo: SmallestUnit<TimeUnit<*>>): Instant
Link copied to clipboard
open external fun since(other: Nothing, options: DifferenceOptions<TimeUnit<*>>): Duration
open external fun since(other: Instant, options: DifferenceOptions<TimeUnit<*>>): Duration
open external fun since(other: String, options: DifferenceOptions<TimeUnit<*>>): Duration
Link copied to clipboard
open external fun subtract(duration: Duration, options: ArithmeticOptions = definedExternally): Instant
open external fun subtract(duration: DurationLike, options: ArithmeticOptions = definedExternally): Instant
open external fun subtract(duration: String, options: ArithmeticOptions = definedExternally): Instant
Link copied to clipboard
external fun toJSON(): String
Link copied to clipboard
open external fun toLocaleString(): String

Returns a value as a string value appropriate to the host environment's current locale.

open external fun toLocaleString(locales: UnicodeBCP47LocaleIdentifier, options: DateTimeFormatOptions = definedExternally): String

Converts a value to a string by using the current or specified locale.

open external fun toLocaleString(locales: ReadonlyArray<UnicodeBCP47LocaleIdentifier>, options: DateTimeFormatOptions = definedExternally): String
open external fun toLocaleString(locales: ReadonlyArray<Locale>, options: DateTimeFormatOptions = definedExternally): String
open external fun toLocaleString(locales: Locale, options: DateTimeFormatOptions = definedExternally): String
Link copied to clipboard
external fun toString(options: InstantToStringOptions = definedExternally): String
Link copied to clipboard
Link copied to clipboard
open external fun until(other: Nothing, options: DifferenceOptions<TimeUnit<*>>): Duration
open external fun until(other: Instant, options: DifferenceOptions<TimeUnit<*>>): Duration
open external fun until(other: String, options: DifferenceOptions<TimeUnit<*>>): Duration