DateTime Picker

Select date and time in one picker.

TIP

DateTimePicker is derived from DatePicker and TimePicker. For a more detailed explanation on attributes, you can refer to DatePicker and TimePicker.

Basic usage

You can select date and time in one picker at the same time by setting type to datetime. The way to use shortcuts is the same as Date Picker.

Range

You can select date and time range by setting type to datetimerange.

DateTime Formats

Use format to control displayed text's format in the input box. Use value-format to control binding value's format.

By default, the component accepts and emits a Date object.

Check the list hereopen in new window of all available formats of Day.js.

WARNING

Pay attention to capitalization

Default time value

When picking date range on the date panel with type datetimerange, 00:00:00 will be used as the default time value for start and end date. We can control it with the default-time attribute. default-time accepts an array of up to two Date objects. The first item controls time value of the start date and the second item controls time value of the end date.

Attributes

NameDescriptionTypeAccepted ValuesDefault
model-value / v-modelbinding value, if it is an array, the length should be 2Date / number / string / Array
readonlywhether DatePicker is read onlybooleanfalse
disabledwhether DatePicker is disabledbooleanfalse
editablewhether the input is editablebooleantrue
clearablewhether to show clear buttonbooleantrue
sizesize of Inputstringlarge / default / smalldefault
placeholderplaceholder in non-range modestring
start-placeholderplaceholder for the start date in range modestring
end-placeholderplaceholder for the end date in range modestring
time-arrow-controlwhether to pick time using arrow buttonsbooleanfalse
typetype of the pickerstringyear / month / date / datetime / week / datetimerange / daterangedate
formatformat of the displayed value in the input boxstringsee date formatsYYYY-MM-DD HH:mm:ss
popper-classcustom class name for DateTimePicker's dropdownstring
range-separatorrange separatorstring'-'
default-valueoptional, default date of the calendarDate / [Date, Date]
default-timethe default time value after picking a date. Time 00:00:00 will be used if not specifiedDate / [Date, Date]
value-formatoptional, format of binding value. If not specified, the binding value will be a Date objectstringsee date formatsopen in new window
idsame as id in native inputstring / [string, string]
namesame as name in native inputstring
unlink-panelsunllink two date-panels in range-pickerbooleanfalse
suffix-iconCustom suffix icon componentstring | ComponentCalendar
clear-iconCustom clear icon componentstring | ComponentClose
shortcutsan object array to set shortcut optionsobject[{ text: string, value: date / function }]
disabled-datea function determining if a date is disabled with that date as its parameter. Should return a Booleanfunction(Date)
cell-class-nameset custom classNameFunction(Date)
teleportedwhether datetime-picker dropdown is teleported to the bodybooleantrue / falsetrue

Events

NameDescriptionParameters
changetriggers when user confirms the valuecomponent's binding value
blurtriggers when Input blurs(e: FocusEvent)
focustriggers when Input focuses(e: FocusEvent)
calendar-changetriggers when the calendar selected date is changed. Only for datetimerange[Date, Date]
visible-changetriggers when the DateTimePicker's dropdown appears/disappearstrue when it appears, and false otherwise

Methods

MethodDescriptionParameters
focusfocus the Input component

Slots

NameDescription
defaultcustom cell content
range-separatorcustom range separator content
Last Updated:
Contributors: Tam Mai