Measured length of time. This incorporates a {@link CalenderInterval} and adds a measured {@link CalendarLength.totalDays} that measures the exact number of days.
For each CalendarUnit, the number of occurrances of that unit per year.
The length of each month, 0-origin, for non-leap and leap years.
The starting day of each month, 0-origin, for non-leap and leap years.
Parse a UTC date.
a string.
a Date
, constrained to 00:00:00.000 UTC
.
Construct a UTC Date
(0-11), default = 0 (January)
(1-31), default = 1
a Date
, constrained to 00:00:00.000 UTC
.
Get the beginning of the supplied day (using UTC for consistency).
Decode a CalendarInterval into [
CalendarUnit, count]
.
Format the date as year-mo-dd
Format the time as year-mo-dd HH:MM:SS
Format the date as year-mo
Format the time as HH:MM:SS
Increment a time by a specified period of time.
The returned value is truncated to the beginning of the UTC day.
The date to be incremented
A CalendarInterval denoting how much to increment by.
Increment a time by a specified period of time.
The returned value is truncated to the beginning of the UTC day.
The date to be incremented
The number of units to increment by
Type guard that determines if the argument is a valid CalendarInterval.
The object under test
Parse a UTC date, in one of the following forms:
2021-08-13
2021-08
// Same as 2021-08-01
2021
// Same as 2021-01-01
Leading zeros on month and day are optional. Two-year year abbreviations are not allowed.
A string in the form YYYY-MMM-dd
a Date at 00:00:00.000 UTC
.
Rolls back time to the start of a year, quarter, month, or day. Higher-order function that returns a function for the specific time period to truncate to.
Unit of time to truncate to (must not be 'week').
(date: {@link Date}) => {@link Date}
Generated using TypeDoc
General calendar utilities. Dates are represented with
Date
objects constrained to00:00:00.000 UTC
. Consistent use of UTC avoids issues with timezones and possible differing behavior.