Skip to main content

Date time picker

Ask AIView as Markdown
Copy a prompt to ask an AI assistant about this page.

Date time pickers offer an interface for selecting both dates and times, which can be used as a standalone element or within a dropdown, providing a seamless way to input date and time values.

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​

Description

ARIA label for the next month icon button.

Will be set as aria-label on the nested HTML button element.

Attribute
aria-label-next-month-button
Type
string | undefined
Default
'Next month'
Description

ARIA label for the previous month icon button.

Will be set as aria-label on the nested HTML button element.

Attribute
aria-label-previous-month-button
Type
string | undefined
Default
'Previous month'
Description

Date format string.

See https://moment.github.io/luxon/#/formatting?id=table-of-tokens for all available tokens.

Attribute
date-format
Type
string
Default
'yyyy/LL/dd'
Description

The selected starting date. If the picker is not in range mode, this is the selected date.

Format has to match the dateFormat property.

Attribute
from
Type
string | undefined
Since 6.0.0
Description

Label for the AM button in 12-hour mode.

Attribute
i18n-am
Type
string
Default
'AM'
Since 6.0.0
Description

Text of the cancel button shown when requireConfirmation is enabled.

Attribute
i18n-cancel
Type
string
Default
'Cancel'
Since 6.0.0
Description

Text of the confirm button shown when requireConfirmation is enabled.

Attribute
i18n-confirm
Type
string
Default
'Confirm'
Description

Text of the date select button.

Attribute
i18n-done
Type
string
Default
'Done'
Since 6.0.0
Description

Text for the time picker hour column header.

Attribute
i18n-hour-column-header
Type
string
Default
'hr'
Since 6.0.0
Description

Text for the time picker millisecond column header.

Attribute
i18n-millisecond-column-header
Type
string
Default
'ms'
Since 6.0.0
Description

Text for the time picker minute column header.

Attribute
i18n-minute-column-header
Type
string
Default
'min'
Since 6.0.0
Description

Label for the PM button in 12-hour mode.

Attribute
i18n-pm
Type
string
Default
'PM'
Since 6.0.0
Description

Text for the time picker second column header.

Attribute
i18n-second-column-header
Type
string
Default
'sec'
Description

Top label of the time picker.

Attribute
i18n-time
Type
string
Default
'Time'
Description

Locale identifier (e.g. 'en' or 'de').

See https://moment.github.io/luxon/#/formatting?id=table-of-tokens for all available tokens.

Attribute
locale
Type
string | undefined
Description

The latest date that can be selected.

If not set there will be no restriction.

Attribute
max-date
Type
string | undefined
Since 5.0.0
Description

Latest selectable time (timeFormat tokens). Invalid non-empty values are ignored.

Attribute
max-time
Type
string | undefined
Description

The earliest date that can be selected.

If not set there will be no restriction.

Attribute
min-date
Type
string | undefined
Since 5.0.0
Description

Earliest selectable time (timeFormat tokens). Invalid non-empty values are ignored.

Attribute
min-time
Type
string | undefined
Since 6.0.0
Description

If 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.

Attribute
require-confirmation
Type
boolean
Default
false
Description

Show AM/PM time reference control.

Attribute
show-time-reference
Type
boolean
Default
false
Description

Shows week numbers displayed on the left side of the date picker.

Attribute
show-week-numbers
Type
boolean
Default
false
Description

If true, disables date range selection (from/to).

Attribute
single-selection
Type
boolean
Default
false
Description

Selected time value for the embedded time picker.

Format has to match the timeFormat property.

Attribute
time
Type
string | undefined
Description

Time format string.

See https://moment.github.io/luxon/#/formatting?id=table-of-tokens for all available tokens.

Attribute
time-format
Type
string
Default
'HH:mm:ss'
Description

Time reference (AM or PM).

Attribute
time-reference
Type
"AM" | "PM" | undefined
Description

The selected end date. If the picker is not in range mode, this property has no impact.

Format has to match the dateFormat property.

Attribute
to
Type
string | undefined
Description

The 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.

Attribute
week-start-index
Type
number
Default
0

Events​

Since 6.0.0
Description

Emitted when the pending selection is discarded via the cancel button,

after dateChange/timeChange reported the restored selection.

Only emitted when requireConfirmation is enabled.

Event
dateCancel
Detail
void
Description

Date 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.

Event
dateChange
Detail
"time" | DateRange<string> & { isoFrom?: string | undefined; isoTo?: string | undefined; } & { time: string; isoTime?: string | undefined; } | string
Breaking change in v6.0.0
from, to and time are localized, use isoFrom, isoTo and isoTime for ISO 8601 values
Description

Datetime selection event. Emitted when the selection is applied via the

done button, or via the confirm button with requireConfirmation.

Event
dateSelect
Detail
DateRange<string> & { isoFrom?: string | undefined; isoTo?: string | undefined; } & { time: string; isoTime?: string | undefined; }
Description

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.

Event
timeChange
Detail
string