Skip to main content

Built and signed on GitHub Actions

JavaScript date utility library for Temporal API

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
3 months ago (0.3.4)
f
areIntervalsOverlapping

Checks if the given two intervals are overlapping. By default, it returns true if the end of one interval is exactly same time to the start of the other interval. You can pass the inclusive option to change this behavior.

I
AreIntervalsOverlappingOptions
No documentation available
T
ArrayOf

Similar to Array, but with union distribution; ArrayOf<A | B> is A[] | B[], not (A|B)[].

f
clamp

Returns a datetime object clamped within the given interval.

f
closestIndexTo

Returns an index of the closest datetime object to the given datetime object from the passed array.

f
closestTo

Returns the closest datetime object to the given datetime object from the passed array.

f
compareAsc

Compares two datetime objects in chronological order and returns -1, 0, or 1.

f
compareDesc

Compares two datetime objects in reverse chronological order and returns -1, 0, or 1.

f
earliest

Returns the earliest of the given datetime objects.

f
endOfDay

Returns the end of a day for the given datetime

f
endOfHour

Returns the end of a hour for the given datetime

f
endOfMinute

Returns the end of a minute for the given datetime

f
endOfMonth

Returns the end of a month for the given datetime

f
endOfSecond

Returns the end of a second for the given datetime

f
endOfYear

Returns the end of a year for the given datetime

f
epochSeconds

Returns an integer of seconds from Unix epoch until the exact time which the given temporal object represents.

f
formatRfc7231

Returns a string in RFC 7231's format which represents an exact time of given temporal object. Units smaller than second are ignored (rounded down).

f
formatWithoutLocale

Returns formatted date string of the Temporal object in the given format. When formatting year, month, or day, this function only accepts a temporal object with ISO calendar by default. If you are 100% sure what you are doing and want to format numeric date info of non-ISO date intentionally, pass formatNonIsoDate option.

I
FormatWithoutLocaleOptions
No documentation available
f
fromRfc2822

Creates Temporal object from datetime string in RFC 2822's format.

f
fromRfc7231

Creates Temporal object from datetime string in RFC 7231's format (HTTP date format) such as Mon, 01 Jan 2024 01:23:45 GMT. This function doesn't support obsoleted formats.

I
GenericDateConstructor

Date or extended Date

T
Interval

The object which represents an interval. start and end should have the same type.

f
isAfter

Checks whether the first datetime is after the second one.

f
isBefore

Checks whether the first datetime is before the second one.

f
isWithinInterval

Checks whether the given datetime is within the interval.

f
julianDay

Returns the julian day of the exact time which the given temporal object represents.

f
latest

Returns the latest of the given datetime objects.

f
startOfDay

Returns the start of a day for the given datetime

f
startOfHour

Returns the start of a hour for the given datetime

f
startOfMinute

Returns the start of a minute for the given datetime

f
startOfMonth

Returns the start of a month for the given datetime

f
startOfSecond

Returns the start of a second for the given datetime

f
startOfYear

Returns the start of a year for the given datetime

f
toDateFromClockTime

Returns Date which represents clock (local) time of given temporal object, dropping timezone and calendar information. When you pass ZonedDateTime, clock time will be unchanged but exact time will change. This function is useful when you want to use formatting functions of date-fns.

f
toTemporalFromClockTime

Returns Temporal instance which represents clock (local) time of given date.

f
isEqual

Check whether two durations are equal

f
longest

Returns the longest of the given durations.

f
shortest

Returns the shortest of the given durations.