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
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
an Iso.Instant string representing the current system time.
Defined in
fromEpochMilliseconds
โธ fromEpochMilliseconds(epochMilliseconds): Instant
Parameters
| Name | Type |
|---|---|
epochMilliseconds | number |
Returns
Defined in
isValid
โธ isValid(instant): instant is Instant
Parameters
| Name | Type |
|---|---|
instant | unknown |
Returns
instant is Instant
Defined in
assertIsValid
โธ assertIsValid(instant): asserts instant is Instant
Parameters
| Name | Type |
|---|---|
instant | unknown |
Returns
asserts instant is Instant
Defined in
getEpochSeconds
โธ getEpochSeconds(instant): number
Parameters
| Name | Type |
|---|---|
instant | Instant |
Returns
number
Defined in
getEpochMilliseconds
โธ getEpochMilliseconds(instant): number
Parameters
| Name | Type |
|---|---|
instant | Instant |
Returns
number
Defined in
add
โธ add(instant, temporalDurationLike): Instant
Here is a comment!
Parameters
| Name | Type |
|---|---|
instant | Instant |
temporalDurationLike | Duration | { years?: number ; months?: number ; weeks?: number ; days?: number ; hours?: number ; minutes?: number ; seconds?: number ; milliseconds?: number } |
Returns
Defined in
subtract
โธ subtract(instant, temporalDurationLike): Instant
Parameters
| Name | Type |
|---|---|
instant | Instant |
temporalDurationLike | Duration | { years?: number ; months?: number ; weeks?: number ; days?: number ; hours?: number ; minutes?: number ; seconds?: number ; milliseconds?: number } |
Returns
Defined in
until
โธ until(from, until, options?): Duration
Parameters
| Name | Type |
|---|---|
from | Instant |
until | Instant |
options? | Object |
options.largestUnit? | TemporalSingularUnit | TemporalPluralUnit | "auto" |
options.smallestUnit? | TemporalSingularUnit | TemporalPluralUnit |
options.roundingIncrement? | number |
options.roundingMode? | TemporalRoundingMode |
Returns
Defined in
since
โธ since(to, since, options?): Duration
Parameters
| Name | Type |
|---|---|
to | Instant |
since | Instant |
options? | Object |
options.largestUnit? | TemporalSingularUnit | TemporalPluralUnit | "auto" |
options.smallestUnit? | TemporalSingularUnit | TemporalPluralUnit |
options.roundingIncrement? | number |
options.roundingMode? | TemporalRoundingMode |
Returns
Defined in
round
โธ round(instant, options): Instant
Parameters
| Name | Type |
|---|---|
instant | Instant |
options | Object |
options.smallestUnit? | TemporalSingularUnit |
options.roundingIncrement? | number |
options.roundingMode? | TemporalRoundingMode |
Returns
Defined in
equals
โธ equals(instant, other): boolean
Parameters
| Name | Type |
|---|---|
instant | Instant |
other | Instant |
Returns
boolean
Defined in
isEqual
โธ isEqual(instant, other): boolean
alias for equals
Parameters
| Name | Type |
|---|---|
instant | Instant |
other | Instant |
Returns
boolean
Defined in
isBefore
โธ isBefore(instant, other): boolean
Parameters
| Name | Type |
|---|---|
instant | Instant |
other | Instant |
Returns
boolean
Defined in
isAfter
โธ isAfter(instant, other): boolean
Parameters
| Name | Type |
|---|---|
instant | Instant |
other | Instant |
Returns
boolean
Defined in
isEqualOrBefore
โธ isEqualOrBefore(instant, other): boolean
Parameters
| Name | Type |
|---|---|
instant | Instant |
other | Instant |
Returns
boolean
Defined in
isEqualOrAfter
โธ isEqualOrAfter(instant, other): boolean
Parameters
| Name | Type |
|---|---|
instant | Instant |
other | Instant |
Returns
boolean
Defined in
toZonedDateTime
โธ toZonedDateTime(instant, timeZone): ZonedDateTime
Parameters
| Name | Type |
|---|---|
instant | Instant |
timeZone | string |
Returns
Defined in
formatISO9075
โธ formatISO9075(instant): string
Parameters
| Name | Type |
|---|---|
instant | Instant |
Returns
string
Defined in
toJsDate
โธ toJsDate(instant): Date
Parameters
| Name | Type |
|---|---|
instant | Instant |
Returns
Date
Defined in
fromEpochSeconds
โธ fromEpochSeconds(epochSeconds): Instant
Parameters
| Name | Type |
|---|---|
epochSeconds | number |
Returns
Defined in
from
โธ from(item): Instant
Parameters
| Name | Type |
|---|---|
item | any |
Returns
Defined in
compare
โธ compare(one, two): number
Parameters
| Name | Type |
|---|---|
one | Instant |
two | Instant |
Returns
number
Defined in
chain
โธ chain(instant): IInstantChain
Parameters
| Name | Type |
|---|---|
instant | Instant |
Returns
IInstantChain