Movable Type Home Page

View from the Labs


Temporal quick reference

JavaScript Temporal – it’s a big API!

Click on for details Now Instant ZonedDateTime PlainDate PlainTime PlainDateTime (rarely used) PlainYearMonth PlainMonthDay Duration TimeZone Calendar
Constructor
Static methods
instant()
timeZoneId()
zonedDateTime(cal, tz?)
zonedDateTimeISO(tz?)
plainDate(cal, tz?)
plainDateISO(tz?)
plainTimeISO(tz?)
plainDateTime(cal, tz?)
plainDateTimeISO(tz?)
from(thing, opts?)
fromEpochSeconds(s)
fromEpochMilliseconds(ms)
fromEpochMicroseconds(μs)
fromEpochNanoseconds(ns)
compare(one, two)
Properties
year/s
month/s
monthCode
weeks
day/s
hour/s
minute/s
second/s
millisecond/s
microsecond/s
nanosecond/s
epochMilliseconds
epochNanoseconds
calendar
timeZoneId
era
eraYear
dayOfWeek
dayOfYear
weekOfYear
daysInWeek
daysInMonth
daysInYear
monthsInYear
inLeapYear
hoursInDay
startOfDay
offsetNanoseconds
offset
sign
blank
id
Methods
with(..., opts?) (zdt-l) (d-l) (t-l) (dt-l) (ym-l) (md-l) (dur-l)
withPlainTime(pt)
withPlainDate(pd)
withTimeZone(tz)
withCalendar(cal)
add(durn, opts?) (other)
subtract(durn, opts?) (other)
until(other, opts?)
since(other, opts?)
negated
abs
round(opts)
equals(other)
total(opts)
getOffsetNanosecondsFor(inst)
getOffsetStringFor(inst)
getPlainDateTimeFor(inst, cal?)
getInstantFor(dt, opts?)
getPossibleInstantsFor(dt)
getNextTransition(start)
getPreviousTransition(start)
toString(opts?)
toLocaleString(locs?, opts?)
toInstant()
toZonedDateTimeISO(tz)
toZonedDateTime(...) ({tz,cal}) (pt|tz)
toPlainDate(...) () () (day) (year)
toPlainTime()
toPlainDateTime(...) () (time) (date)
toPlainYearMonth()
toPlainMonthDay()
(methods which do not usually need to be called directly are omitted)