Skip to content

createDateRange · <tz-date-range> ​

Options ​

OptionTypeDefault
valueDateRangeValueEMPTYThe two ends. Either may be unset while a range is being chosen.
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, and the order of a date. The browser's own when left out.
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 already full.
todayPlainDateTemporal.Now.plainDateISO()Which day is today. Settable so a test does not depend on the day it runs.
blockAcrossDisabledbooleantrueRefuse a range that steps over a day ruled out by isDateDisabled. On by default, because the usual reason a day is unavailable is that the thing being booked is not available then — and a booking that spans a closure cannot be honoured. Turn it off for ranges that merely bracket a period, like a report's dates.
rangeSpansBlockedMessagestring | undefined—Overrides messages.rangeCrossesUnavailable for this one instance.
messagesTzslotMessagesENThe words the widget says. One bundle, English and French included.
renderCellRenderCell | undefined—Adds to each day: a price per night, places left, a class of your own.
weekNumbersbooleanfalseA column of ISO week numbers down the left.
monthsnumber1How many months to show side by side. Two is what a range wants: most of them cross a month boundary, and one month means navigating mid-choice.

Callbacks ​

Type
onChange((value: DateRangeValue) => void) | undefinedCalled when the user chooses, changes or clears the value.

MIT