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
2 months ago (0.3.3)
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.

T
ArrayOf
No documentation available
f
clamp

Returns a datetime object clamped within the given interval.

  • When the given datetime is earlier than the start of the interval, the start will be returned.
  • When the given datetime is later than the end of the interval, the end will be returned.
  • Otherwise the given datetime will be returned.
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
formatWithoutLocale

Returns formatted date string of the Temporal object in the given format. Available field patterns are subset of date field symbols in Unicode CLDR, see https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table for details.

I
GenericDateConstructor
No documentation available
T
Interval
No documentation available
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
latest

Returns the latest of the given datetime objects.

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.