Skip to content

createDateTimeRange · <tz-datetime-range> ​

Options ​

OptionTypeDefault
valueDateTimeRangeValueEMPTYThe two moments. Either may be unset while the interval is being built.
openEndedbooleanfalseLets the interval stop at one end: "from 14 September", "until the 20th". A search means that; a booking does not. Without it, one end on its own is an unfinished selection and nothing is said about it.
timeZonestring'UTC'An IANA identifier. Both ends are read on this zone's clocks.
allDaybooleanfalseWhole days rather than moments: midnight to midnight, no times shown. Two-way — the switch inside the widget sets it, and so can you.
allDaySwitchbooleantrueWhether that switch is offered at all.
timeLayoutTimeLayout'input'How each end asks for its time: a compact field, two menus, or the day's times.
stepMinutesnumber30Minutes between the times offered.
minuteStepnumber1With 'select': minutes between the options. Every minute by default.
minTimePlainTime | string | undefined—The earliest time offered.
maxTimePlainTime | string | undefined—The latest time offered.
isSlotDisabled((slot: Omit<Slot, 'disabled'>) => boolean) | undefined—Only with timeLayout 'list': rules out slots while still showing them.
hour12boolean | undefined—Twelve-hour with an AM/PM control. The locale decides when left out.
defaultTimePlainTime | string'00:00'The time a newly chosen day starts at. Midnight by default.
editablebooleantrueEach end can be typed into as well as chosen from.
maskbooleantrueSeparators appear as the figures are typed.
formatstring | undefined—A pattern for both ends — yyyy-MM-dd HH:mm.
minPlainDate | nullnullThe earliest day that can be chosen.
maxPlainDate | nullnullThe latest day that can be chosen.
isDateDisabled((date: PlainDate) => boolean) | undefined—Rules out individual days inside the range: closures, weekends, days already full.
todayPlainDateTemporal.Now.plainDateISO()Which day is today, in both panels. Settable so a test does not drift.
renderCellRenderCell | undefined—Adds to each day: a note under the number, a class of your own, a tooltip, or a reason to rule it out.
buttonsreadonly CalendarButton[][]Buttons under the grid: 'today', 'clear'. None by default.
weekNumbersbooleanfalseA column of ISO week numbers down the left of each panel's calendar.
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.
disabledbooleanfalseNothing can be chosen while this is set.
startLabelstring | undefined—The heading over the first end.
endLabelstring | undefined—The heading over the second end.
endBeforeStartMessagestring | undefined—Said when the second moment comes before the first.
messagesTzslotMessagesENThe words the widget says. One bundle, English and French included.

Callbacks ​

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

MIT