Skip to content

DateChooser

Properties

PropertyTypeDefaultDescription
type'day'|'month'|'year''day'Defines the date unit to display as one of 'day', 'month', or 'year'.
todayDatenew Date()Defines today's date.
headerPatternsobjectFormat of the date displayed in the header. { day: 'YYYY.MM', month: 'YYYY', year: '{YYYY} ~ {YYYY}' }
patternsRecord<'day'|'month'|'year', string>Format of the displayed date. { day: 'YYYY.MM.DD', month: 'YYYY.MM.DD', year: 'YYYY' }
allowRangebooleanfalseWhether users can select a date range.
allowDates(date: Date) => booleanFunction that defines selectable dates.
selectedRangeArray<Date>Defines the selected date range. Set in the form of [new Date('2020/1/1'), new Date('2020/1/31')].
selectedDateDateDefines the selected date. Set in the form of new Date('2020/1/1').
selectedDateStringstringReturns the selected date as a string. Determined by the formatter and pattern property.

Methods

MethodParametersDescription
clearvoidDeletes the selected date.
resetvoidMoves to the selected date, or to today's date if no date is selected.
setCurrentDate(date: Date)Moves the displayed date list to the specified date.
getStatevoidReturns the current display state ('day', 'month', 'year').

Events

EventTypeDescription
selection-changing(event: SelectionEvent<T>) => voidOccurs before an item is selected. Selection can be cancelled by calling preventDefault.
selection-change(event: SelectionEvent<T>) => voidOccurs after an item is selected.
state-change(event: CustomEvent<{value: DateType; oldValue: DateType}>) => voidOccurs whenever the calendar's state changes.
item-down(event: ItemEvent<DateItem>) => voidOccurs when mouse down on an item.
item-click(event: ItemEvent<DateItem>) => voidOccurs when mouse click on an item.