Skip to main content

Function: makeDate()

makeDate(year, month, day): CalendarDate

Defined in: src/lib/dates/index.ts:54

Construct and validate a CalendarDate. The canonical, range-checked way to build a date.

Parameters

year

number

Full year.

month

number

Month, 1-12 (1-indexed).

day

number

Day of month; must be 1 through the number of days in the given month/year.

Returns

CalendarDate

A validated CalendarDate.

Throws

DateError if month is outside 1-12, or day is outside 1..daysInMonth for that month.