Skip to main content

Instant

ฦฌ Instant: Format["YYYY-MM-DDThh:mm-ss[.sss]Z"] & string

An Iso.Instant is a single point in time (called "exact time"), with a precision in milliseconds. No time zone is present. As such Iso.Instant has no concept of days, months or even hours.

For convenience of interoperability, instants are represented as an ISO8601 string in Zulu time (UTC). The format looks like 1970-01-01T00:00:00.000Z.

If you have a legacy Date instance, you can use its toISOString() method to convert to an Iso.Instant.

Since Iso.Instant doesn't contain any information about time zones, a Iso.TimeZone is needed in order to convert it into a Iso.DateTime (and from there into any of the other Iso types.)

Like Unix time, Instant ignores leap seconds.

Defined in

iso-types.ts:39

now

โ–ธ now(): Instant

This method gets the current exact system time, without regard to time zone. This is a good way to get a timestamp for an event, for example. It works like the old-style JavaScript Date.now().

Returns

Instant

an Iso.Instant string representing the current system time.

Defined in

types/IInstantFns.ts:13


fromEpochMilliseconds

โ–ธ fromEpochMilliseconds(epochMilliseconds): Instant

Parameters

NameType
epochMillisecondsnumber

Returns

Instant

Defined in

types/IInstantFns.ts:14


isValid

โ–ธ isValid(instant): instant is Instant

Parameters

NameType
instantunknown

Returns

instant is Instant

Defined in

types/IInstantFns.ts:15


assertIsValid

โ–ธ assertIsValid(instant): asserts instant is Instant

Parameters

NameType
instantunknown

Returns

asserts instant is Instant

Defined in

types/IInstantFns.ts:16


getEpochSeconds

โ–ธ getEpochSeconds(instant): number

Parameters

NameType
instantInstant

Returns

number

Defined in

types/IInstantFns.ts:17


getEpochMilliseconds

โ–ธ getEpochMilliseconds(instant): number

Parameters

NameType
instantInstant

Returns

number

Defined in

types/IInstantFns.ts:18


add

โ–ธ add(instant, temporalDurationLike): Instant

Here is a comment!

Parameters

NameType
instantInstant
temporalDurationLikeDuration | { years?: number ; months?: number ; weeks?: number ; days?: number ; hours?: number ; minutes?: number ; seconds?: number ; milliseconds?: number }

Returns

Instant

Defined in

types/IInstantFns.ts:24


subtract

โ–ธ subtract(instant, temporalDurationLike): Instant

Parameters

NameType
instantInstant
temporalDurationLikeDuration | { years?: number ; months?: number ; weeks?: number ; days?: number ; hours?: number ; minutes?: number ; seconds?: number ; milliseconds?: number }

Returns

Instant

Defined in

types/IInstantFns.ts:39


until

โ–ธ until(from, until, options?): Duration

Parameters

NameType
fromInstant
untilInstant
options?Object
options.largestUnit?TemporalSingularUnit | TemporalPluralUnit | "auto"
options.smallestUnit?TemporalSingularUnit | TemporalPluralUnit
options.roundingIncrement?number
options.roundingMode?TemporalRoundingMode

Returns

Duration

Defined in

types/IInstantFns.ts:54


since

โ–ธ since(to, since, options?): Duration

Parameters

NameType
toInstant
sinceInstant
options?Object
options.largestUnit?TemporalSingularUnit | TemporalPluralUnit | "auto"
options.smallestUnit?TemporalSingularUnit | TemporalPluralUnit
options.roundingIncrement?number
options.roundingMode?TemporalRoundingMode

Returns

Duration

Defined in

types/IInstantFns.ts:64


round

โ–ธ round(instant, options): Instant

Parameters

NameType
instantInstant
optionsObject
options.smallestUnit?TemporalSingularUnit
options.roundingIncrement?number
options.roundingMode?TemporalRoundingMode

Returns

Instant

Defined in

types/IInstantFns.ts:74


equals

โ–ธ equals(instant, other): boolean

Parameters

NameType
instantInstant
otherInstant

Returns

boolean

Defined in

types/IInstantFns.ts:82


isEqual

โ–ธ isEqual(instant, other): boolean

alias for equals

Parameters

NameType
instantInstant
otherInstant

Returns

boolean

Defined in

types/IInstantFns.ts:86


isBefore

โ–ธ isBefore(instant, other): boolean

Parameters

NameType
instantInstant
otherInstant

Returns

boolean

Defined in

types/IInstantFns.ts:87


isAfter

โ–ธ isAfter(instant, other): boolean

Parameters

NameType
instantInstant
otherInstant

Returns

boolean

Defined in

types/IInstantFns.ts:88


isEqualOrBefore

โ–ธ isEqualOrBefore(instant, other): boolean

Parameters

NameType
instantInstant
otherInstant

Returns

boolean

Defined in

types/IInstantFns.ts:89


isEqualOrAfter

โ–ธ isEqualOrAfter(instant, other): boolean

Parameters

NameType
instantInstant
otherInstant

Returns

boolean

Defined in

types/IInstantFns.ts:90


toZonedDateTime

โ–ธ toZonedDateTime(instant, timeZone): ZonedDateTime

Parameters

NameType
instantInstant
timeZonestring

Returns

ZonedDateTime

Defined in

types/IInstantFns.ts:91


formatISO9075

โ–ธ formatISO9075(instant): string

Parameters

NameType
instantInstant

Returns

string

Defined in

types/IInstantFns.ts:92


toJsDate

โ–ธ toJsDate(instant): Date

Parameters

NameType
instantInstant

Returns

Date

Defined in

types/IInstantFns.ts:93


fromEpochSeconds

โ–ธ fromEpochSeconds(epochSeconds): Instant

Parameters

NameType
epochSecondsnumber

Returns

Instant

Defined in

types/IInstantFns.ts:94


from

โ–ธ from(item): Instant

Parameters

NameType
itemany

Returns

Instant

Defined in

types/IInstantFns.ts:95


compare

โ–ธ compare(one, two): number

Parameters

NameType
oneInstant
twoInstant

Returns

number

Defined in

types/IInstantFns.ts:96


chain

โ–ธ chain(instant): IInstantChain

Parameters

NameType
instantInstant

Returns

IInstantChain

Defined in

types/IInstantFns.ts:97