Tanguv0.35.0
Time & date14 exports
Raw Markdown

/calendar/gregorian

Pure Gregorian calendar arithmetic: leap years, days in month, weekday indices, and date comparison.

(use /calendar/gregorian)

Functions & symbols#

add-days#

function
(add-days date day-offset)

Shifts a Gregorian date by whole days.

ParameterTypeOptionalDescription
dateAnyrequired—
day-offsetAnyrequired—
Returns:Any

add-months#

function
(add-months date month-offset)

Shifts a Gregorian date map by a whole number of months.

ParameterTypeOptionalDescription
dateAnyrequired—
month-offsetAnyrequired—
Returns:Any

add-months-to-year-month#

function
(add-months-to-year-month year month month-offset)

Shifts a year-month pair by whole months.

ParameterTypeOptionalDescription
yearAnyrequired—
monthAnyrequired—
month-offsetAnyrequired—
Returns:Any

compare-dates#

function
(compare-dates left right)

Compares two Gregorian dates.

ParameterTypeOptionalDescription
leftAnyrequired—
rightAnyrequired—
Returns:Any

compute-weekday-index#

function
(compute-weekday-index date)

Returns the weekday index for a Gregorian date using Sunday as zero.

ParameterTypeOptionalDescription
dateAnyrequired—
Returns:Any

construct-date#

function
(construct-date year month day)

Constructs a valid Gregorian date map.

ParameterTypeOptionalDescription
yearAnyrequired—
monthAnyrequired—
dayAnyrequired—
Returns:Any

construct-today-date#

function
(construct-today-date)

Returns the current local Gregorian date.

Returns:Any

date-from-epoch-days#

function
(date-from-epoch-days epoch-days)

Converts an epoch day count into a Gregorian date.

ParameterTypeOptionalDescription
epoch-daysAnyrequired—
Returns:Any

date-from-iso-text#

function
(date-from-iso-text text)

Parses an ISO date string into a Gregorian date map.

ParameterTypeOptionalDescription
textAnyrequired—
Returns:Any

days-in-month#

function
(days-in-month year month)

Returns the number of days in a Gregorian month.

ParameterTypeOptionalDescription
yearAnyrequired—
monthAnyrequired—
Returns:Any

epoch-days-from-date#

function
(epoch-days-from-date date)

Converts a Gregorian date into an epoch day count.

ParameterTypeOptionalDescription
dateAnyrequired—
Returns:Any

is-leap-year?#

function
(is-leap-year? year)

Returns true when the year uses the Gregorian leap-year rules.

ParameterTypeOptionalDescription
yearAnyrequired—
Returns:Any

is-same-date?#

function
(is-same-date? left right)

Returns true when two Gregorian dates match exactly.

ParameterTypeOptionalDescription
leftAnyrequired—
rightAnyrequired—
Returns:Any

iso-text-from-date#

function
(iso-text-from-date date)

Formats a Gregorian date as YYYY-MM-DD.

ParameterTypeOptionalDescription
dateAnyrequired—
Returns:Any