An Iso.Instant is a single point in time (called "exact time"). No time zone is present. As such Iso.Instant has no concept of days, months or even hours.
Accessors and arithmetic operate at millisecond precision, but the string representation itself preserves whatever fractional-second precision was parsed (including sub-millisecond), matching the underlying Temporal behavior.
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.
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.
fromEpochMilliseconds()
fromEpochMilliseconds(
epochMilliseconds):Instant
Parameters
epochMilliseconds
number
Returns
isValid()
isValid(
instant):instant is Instant
Parameters
instant
unknown
Returns
instant is Instant
assertIsValid()
assertIsValid(
instant):asserts instant is Instant
Parameters
instant
unknown
Returns
asserts instant is Instant
getEpochSeconds()
getEpochSeconds(
instant):number
Parameters
instant
Returns
number
getEpochMilliseconds()
getEpochMilliseconds(
instant):number
Parameters
instant
Returns
number
add()
add(
instant,temporalDurationLike):Instant
Here is a comment!
Parameters
instant
temporalDurationLike
Duration | { years?: number; months?: number; weeks?: number; days?: number; hours?: number; minutes?: number; seconds?: number; milliseconds?: number; }
Returns
subtract()
subtract(
instant,temporalDurationLike):Instant
Parameters
instant
temporalDurationLike
Duration | { years?: number; months?: number; weeks?: number; days?: number; hours?: number; minutes?: number; seconds?: number; milliseconds?: number; }
Returns
until()
until(
instant,other,options?):Duration
Parameters
instant
other
options?
largestUnit?
LargestUnit\<TimeUnit>
smallestUnit?
SmallestUnit\<TimeUnit>
roundingIncrement?
number
roundingMode?
RoundingMode
Returns
since()
since(
instant,other,options?):Duration
Parameters
instant
other
options?
largestUnit?
LargestUnit\<TimeUnit>
smallestUnit?
SmallestUnit\<TimeUnit>
roundingIncrement?
number
roundingMode?
RoundingMode
Returns
round()
round(
instant,options):Instant
Parameters
instant
options
smallestUnit
SmallestUnit\<TimeUnit>
roundingIncrement?
number
roundingMode?
RoundingMode
Returns
equals()
equals(
instant,other):boolean
Parameters
instant
other
Returns
boolean
isEqual()
isEqual(
instant,other):boolean
alias for equals
Parameters
instant
other
Returns
boolean
isBefore()
isBefore(
instant,other):boolean
Parameters
instant
other
Returns
boolean
isAfter()
isAfter(
instant,other):boolean
Parameters
instant
other
Returns
boolean
isEqualOrBefore()
isEqualOrBefore(
instant,other):boolean
Parameters
instant
other
Returns
boolean
isEqualOrAfter()
isEqualOrAfter(
instant,other):boolean
Parameters
instant
other
Returns
boolean
toZonedDateTime()
toZonedDateTime(
instant,timeZone):ZonedDateTime
Parameters
instant
timeZone
string
Returns
formatISO9075()
formatISO9075(
instant):string
Parameters
instant
Returns
string
toJsDate()
toJsDate(
instant):Date
Parameters
instant
Returns
Date
fromEpochSeconds()
fromEpochSeconds(
epochSeconds):Instant
Parameters
epochSeconds
number
Returns
from()
from(
item):Instant
Parameters
item
string
Returns
compare()
compare(
one,two):number
Parameters
one
two
Returns
number
chain()
chain(
instant):IInstantChain
Parameters
instant
Returns
IInstantChain