Skip to content

createCalendar · <tz-calendar> ​

Options ​

OptionTypeDefault
valuePlainDate | nullmode.emptyThe selected day.
viewCalendarView'days'Which level the grid is choosing between.
minViewCalendarView'days'How far down the view may go. 'months' turns this into a month picker, 'years' into a year picker, with no further code.
firstDayOfWeekWeekday | undefined—Where the week starts, 1 for Monday through 7 for Sunday. Left out, the locale decides — Monday in France, Sunday in the United States. Set it only where a business disagrees with its own locale.
localestring | undefined—A BCP-47 tag for the month and weekday names. Defaults to the browser's.
minPlainDate | nullnullThe earliest day that can be chosen.
maxPlainDate | nullnullThe latest day that can be chosen.
disabledbooleanfalseNothing can be chosen while this is set.
isDateDisabled((date: PlainDate) => boolean) | undefined—Rules out individual days inside the range: closures, weekends, days that are already full. Bounds cut the ends off; this takes holes out of the middle, which bounds cannot express.
todayPlainDateTemporal.Now.plainDateISO()Today, settable so a test does not depend on the day it runs.
messagesTzslotMessagesENThe words the widget says. One bundle, English and French included.
renderCellRenderCell | undefined—Adds to each day: a price, places left, a class of your own, or a reason to rule it out. See RenderCell.
buttonsreadonly CalendarButton[][]Buttons under the grid, in the order given. None by default.
weekNumbersbooleanfalseA column of ISO week numbers down the left. Ordinary in Europe, where a fortnight is often "weeks 38 and 39" rather than a pair of dates.

Callbacks ​

Type
onChange((value: PlainDate | null) => void) | undefinedA day was chosen, or the selection cleared — by the user or by clear().
onViewChange((view: CalendarView) => void) | undefinedCalled when the grid moves between days, months and years.

MIT