Date time picker - Code
Basic
Require confirmation
By default, date time pickers apply every pick immediately and Done finishes the selection.
Set requireConfirmation to only apply the date and time when users click Confirm.
Cancel restores the last confirmed value.
Date time pickers emit dateChange and timeChange for every pick and dateSelect only when they apply the selection (on Done or Confirm).
API for ix-datetime-picker
Properties
ARIA label for the next month icon button.
Will be set as aria-label on the nested HTML button element.
aria-label-next-month-buttonstring | undefined'Next month'ARIA label for the previous month icon button.
Will be set as aria-label on the nested HTML button element.
aria-label-previous-month-buttonstring | undefined'Previous month'Date format string.
See https://moment.github.io/luxon/#/formatting?id=table-of-tokens for all available tokens.
date-formatstring'yyyy/LL/dd'The selected starting date. If the picker is not in range mode, this is the selected date.
Format has to match the dateFormat property.
fromstring | undefinedLabel for the AM button in 12-hour mode.
i18n-amstring'AM'Text of the cancel button shown when requireConfirmation is enabled.
i18n-cancelstring'Cancel'Text of the confirm button shown when requireConfirmation is enabled.
i18n-confirmstring'Confirm'Text of the date select button.
i18n-donestring'Done'Text for the time picker hour column header.
i18n-hour-column-headerstring'hr'Text for the time picker millisecond column header.
i18n-millisecond-column-headerstring'ms'Text for the time picker minute column header.
i18n-minute-column-headerstring'min'Label for the PM button in 12-hour mode.
i18n-pmstring'PM'Text for the time picker second column header.
i18n-second-column-headerstring'sec'Top label of the time picker.
i18n-timestring'Time'Locale identifier (e.g. 'en' or 'de').
See https://moment.github.io/luxon/#/formatting?id=table-of-tokens for all available tokens.
localestring | undefinedThe latest date that can be selected.
If not set there will be no restriction.
max-datestring | undefinedLatest selectable time (timeFormat tokens). Invalid non-empty values are ignored.
max-timestring | undefinedThe earliest date that can be selected.
If not set there will be no restriction.
min-datestring | undefinedEarliest selectable time (timeFormat tokens). Invalid non-empty values are ignored.
min-timestring | undefinedIf true, a selection is only applied after the user confirms it with the
confirm button, which emits dateSelect. The cancel button discards the
pending selection.
If false, the done button emits dateSelect. In both modes dateChange
and timeChange are emitted for every selection.
require-confirmationbooleanfalseShow AM/PM time reference control.
show-time-referencebooleanfalseShows week numbers displayed on the left side of the date picker.
show-week-numbersbooleanfalseIf true, disables date range selection (from/to).
single-selectionbooleanfalseSelected time value for the embedded time picker.
Format has to match the timeFormat property.
timestring | undefinedTime format string.
See https://moment.github.io/luxon/#/formatting?id=table-of-tokens for all available tokens.
time-formatstring'HH:mm:ss'Time reference (AM or PM).
time-reference"AM" | "PM" | undefinedThe selected end date. If the picker is not in range mode, this property has no impact.
Format has to match the dateFormat property.
tostring | undefinedThe index of the day the week starts on, as a 0-based index into Luxon's
Info.weekdays() array. That array is always ordered Monday-first
regardless of locale, so 0 is Monday, 1 is Tuesday and 6 is Sunday.
E.g. weekStartIndex = 6 results in starting the week on Sunday.
week-start-indexnumber0Events
Emitted when the pending selection is discarded via the cancel button,
after dateChange/timeChange reported the restored selection.
Only emitted when requireConfirmation is enabled.
dateCancelvoidDate change event. Emitted when the date changes in the embedded date picker.
Emitted for every pick, also for a range with only a start date and for
a selection that is not confirmed yet (requireConfirmation). When a
pending selection is discarded, it is emitted with the confirmed date
again. Use dateSelect for the applied selection.
dateChange"time" | DateRange<string> & { isoFrom?: string | undefined; isoTo?: string | undefined; } & { time: string; isoTime?: string | undefined; } | stringDatetime selection event. Emitted when the selection is applied via the
done button, or via the confirm button with requireConfirmation.
dateSelectDateRange<string> & { isoFrom?: string | undefined; isoTo?: string | undefined; } & { time: string; isoTime?: string | undefined; }Time change event. Emitted when the time changes in the embedded time picker.
Emitted for every pick, also for a selection that is not confirmed yet
(requireConfirmation). When a pending selection is discarded, it is
emitted with the confirmed time again, or the default time if none is
confirmed, which is also emitted on load. Use dateSelect for the
applied selection.
timeChangestring