Skip to content

createDateField · <tz-date-field> ​

Options ​

OptionTypeDefault
valuePlainDate | nullnullThe chosen day.
modeFieldMode'popup''popup' hangs the panel under the field; 'dialog' centres it over the page.
placeholderstring | undefined—What the field shows while it holds nothing.
ariaLabelstring | undefined—The trigger's and the panel's accessible name. Defaults to messages.chooseDate.
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.
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.
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.
disabledbooleanfalseNothing can be chosen while this is set.
displayWith((date: PlainDate) => string) | undefined—How the chosen date is written in the field. Defaults to the locale's medium form.
todayPlainDateTemporal.Now.plainDateISO()Which day is 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—Passed to the calendar in the panel.
buttonsreadonly CalendarButton[][]Under the panel's grid: 'today', 'clear'. Choosing either closes it.
weekNumbersbooleanfalseA column of ISO week numbers down the left of the panel's calendar.

Callbacks ​

Type
onChange((value: PlainDate | null) => void) | undefinedCalled when the user chooses, changes or clears the value.
onOpen(() => void) | undefinedCalled when the panel opens.
onClose(() => void) | undefinedCalled when the panel closes.

MIT