Skip to content

createDateTimeField · <tz-datetime-field> ​

Options ​

OptionTypeDefault
valueInstant | nullnullA moment, because a date and a wall time alone are not one.
timeZonestringTemporal.Now.timeZoneId()An IANA identifier. The date and the time are read on this zone's clocks.
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 accessible name, for a screen reader.
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.
firstDayOfWeek1 | 2 | 3 | 4 | 5 | 6 | 7 | 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.
showTimebooleantrueWhether a time is asked for at all. False leaves a field that chooses a day and holds the moment it starts — what a whole-day range needs, with everything else about the field unchanged.
snapMinutesnumber | nullnullMove a typed time to the nearest mark of this grid — 15 for quarter-hour appointments, ties upward. Off by default: a screen that accepts any minute must not have them quietly moved.
shiftboolean | DurationLike | readonly ShiftOption[]falseHow far one press of an arrow moves the moment, and whether there are arrows at all. false — the default — draws none. true draws them and moves by a day, which is what one date is chosen in. A duration imposes the step, in whatever shape the business needs; a list offers several and lets the reader pick between them, showStep deciding whether that picker shows. Counted on the zone's clocks, so an hour is an hour of real time on the two mornings that are not twenty-four hours long.
showStepbooleantrueWhether the step sits between the arrows, where the reader can read it and press it. It appears when shift is a list; a list of one shows the step without handing it over. false hides it even then.
timeLayoutTimeLayout'input'How the time is chosen: 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 day starts out with, so that choosing a date is already a moment. Midnight by default, moved up to minTime when there is one.
disabledbooleanfalseNothing can be chosen while this is set.
editablebooleantrueThe text can be typed as well as chosen. What is typed is read with the same pattern the field writes, so the two always agree; anything that is not a date goes back to the last one when the field is left.
maskbooleantrueThe separators appear as the figures are typed, the way a card number gets its spaces. Only for patterns that leave no doubt — dd/MM/yyyy does, d/M/yyyy does not.
formatstring | undefined—A pattern — yyyy-MM-dd HH:mm — when the shape matters more than the reader. Unset, the field follows the locale: its numeric order when it can be typed into, dateStyle and timeStyle when it cannot.
dateStyle'full' | 'long' | 'medium' | 'short''medium'Intl's own form for the date, when the field is not typed into.
timeStyle'full' | 'long' | 'medium' | 'short''short'Intl's own form for the time, when the field is not typed into.
displayWith((value: Instant, timeZone: string) => string) | undefined—The last word on the text. Given both, this one wins.
todayPlainDateTemporal.Now.plainDateISO()Which day is today. Settable so a test does not depend on the day it runs.
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 the panel's calendar.
messagesTzslotMessagesENThe words the widget says. One bundle, English and French included.

Callbacks ​

Type
onChange((value: Instant | 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