Skip to content
🌏 Translated with the assistance of DeepSeek and ChatGPT

DatePicker

A control for selecting a date.

PS: DatePicker, TimePicker, and DateTimePicker are likely the same component internally.

Basic Usage

Pass modelValue to enter controlled mode. If not passed or undefined, it will be uncontrolled mode, and you can pass the defaultValue prop as the default value.

Hide source code

Date Range

Hide source code

Year Selection

Hide source code

Month Selection

Hide source code

Quarter Selection

Hide source code

Week Selection

Hide source code

Quick Access

Date
Hide source code

Custom Separator

TO
Hide source code

Custom Formatting

Set the formatting template via template. Additionally, you can use format and parse to customize formatting and parsing functions. When the date string fails to parse, the component will keep the previous input value.

Hide source code

More Options

DatePicker also supports most of the features of the Input component.

Disabled, Readonly, Loading & Clearable

Shape

Size

Slot

prefix
suffix

Composite

Start:

Status

Expose

Hide source code

Formatter

The component supports time formatting templates based on regular expression matching. The following template tokens can be used to parse various parts of a time string.

TokenRegex PatternDescription
YYYY(-?\d{4,6})Year, supports 4 to 6 digits, may include a minus sign (e.g., for BC)
YY(\d{2})Last two digits of the year
MM(\d{2})Month, two digits (01-12)
DD(\d{2})Day of month, two digits (01-31)
HH(\d{2})Hour (24-hour clock), two digits (00-23)
hh(\d{2})Hour (12-hour clock), two digits (01-12)
mm(\d{2})Minute, two digits (00-59)
ss(\d{2})Second, two digits (00-59)
SSS(\d{3})Millisecond, three digits (000-999)
A(AM|PM)AM/PM marker, uppercase AM or PM
ww(\d{2})Week number, week of the year, two digits (01-53, following ISO week date rules)
Q(\d{1})Quarter, one digit (1-4)

Text enclosed in square brackets [] will be extracted and preserved as-is. For example, YYYY-[Q]Q produces 2026-Q1, where the Q inside brackets remains literal.

Week calculation follows the ISO 8601 standard: the week starts on Monday, and the first week of the year is the week that contains the first Thursday of that year.

API

DatePickerProps

AttributeTypeOptionalDefaultDescriptionVersion
modelValueDate | Date[] | nullTrueThe value of the date picker (controlled mode), supports v-model.0.2.0
defaultValueDate | Date[] | nullTrueThe default value of the date picker (uncontrolled mode).0.2.0
mode'date' | 'date-range' | 'year' | 'year-range' | 'month' | 'month-range' | 'quarter' | 'quarter-range' | 'week'True'date'The selection mode of the date picker.0.2.0
placeholderstringTruePlaceholder text.0.2.0
placeholderStartstringTruePlaceholder text for the start date.0.2.0
placeholderEndstringTruePlaceholder text for the end date.0.2.0
disabledbooleanTruefalseWhether it is disabled.0.2.0
readonlybooleanTruefalseWhether it is read-only.0.2.0
clearablebooleanTruefalseWhether to show the clear button.0.2.0
loadingbooleanTruefalseWhether to show the loading state.0.2.0
templatestringTrueDate formatting template.0.2.0
format(time: Date) => stringTrueDate formatting function, takes precedence over template.0.2.0
parse(timeString: string) => DateTrueFunction to parse a formatted string into a date, takes precedence over template.0.2.0
size'medium' | 'large' | 'small'True'medium'Size of the date picker input box.0.2.0
shape'rect' | 'round'True'rect'Shape of the date picker input box.0.2.0
borderRadiusNumberOrPercentage | NumberOrPercentage[]TrueBorder radius, higher priority than shape, consistent with CSS border-radius behavior; a single value or array of length 1 → applies to all four corners; array of length 2 → [top-left & bottom-right, top-right & bottom-left]; array of length 3 → [top-left, top-right & bottom-left, bottom-right]; array of length 4 → applies to corners in clockwise order.0.2.0
status'success' | 'warning' | 'error' | 'normal'TrueForm validation status.0.2.0
autofocusbooleanTruefalseNative <input> autofocus attribute.0.2.0
autofocusStartbooleanTruefalseNative <input> autofocus attribute for the start date.0.2.0
autofocusEndbooleanTruefalseNative <input> autofocus attribute for the end date.0.2.0
dropdownDestroyOnHidebooleanTruefalseWhether the dropdown panel is destroyed when hidden.0.2.0
pollSizeChangebooleanTruefalseEnable polling for component size changes, may affect performance.0.2.0
dropdownPropsOmit<PopoverProps, 'visible' | 'content'> & EmitEvent<PopoverEvents>TrueProps for the dropdown panel.0.2.0
needDropdownbooleanTruefalseWhether to show the dropdown panel.0.2.0
quickAccessQuickAccessOption[]TrueOptions for the quick jump button.0.2.0

DatePickerEvents

EventParameterDescriptionVersion
inputvalue: string, event: EventCallback when inputting in the date picker.0.2.0
update:modelValuevalue: Date | Date[] | nullCallback for updating modelValue.0.2.0
changevalue: Date | Date[] | null, event?: EventCallback when the date picker value changes.0.2.0
clearvalue: Date | Date[] | nullCallback when clearing the content by clicking the clear button.0.2.0
blurevent: FocusEventCallback when the date picker loses focus.0.2.0
focusevent: FocusEventCallback when the date picker receives focus.0.2.0
selectvalue: Date | Date[], event: MouseEventCallback when the date picker value is changed via the dropdown panel.0.2.0
monthPrevreferredDate: Date, event: MouseEventCallback when moving to the previous month in the date panel.0.2.0
monthNextreferredDate: Date, event: MouseEventCallback when moving to the next month in the date panel.0.2.0
yearPrevreferredDate: Date, event: MouseEventCallback when moving to the previous year in the date panel.0.2.0
yearNextreferredDate: Date, event: MouseEventCallback when moving to the next year in the date panel.0.2.0
referredDateSelectreferredDate: Date, event: MouseEventCallback when selecting a year/month via the dropdown options in the date panel.0.2.0
referredDateChangereferredDate: Date, event: MouseEventCallback when the year/month changes in the date panel.0.2.0
dropdownOpenCallback when the dropdown panel is opened.0.2.0
dropdownCloseCallback when the dropdown panel is closed.0.2.0

DatePickerSlots

SlotParameterDescriptionVersion
prefixPrefix content.0.2.0
suffixSuffix content.0.2.0
splitterSeparator content for range selection.0.2.0
quickquickAccess: QuickAccessOptionThe bottom slot of the dropdown panel.0.2.0

DatePickerExpose

AttributeTypeOptionalDefaultDescriptionVersion
focus(placement?: 'start' | 'end') => voidFalseFocus the current control; for range selection, defaults to the start date if placement is not provided.0.2.0
blur(placement?: 'start' | 'end') => voidFalseBlur the current control; for range selection, defaults to the start date if placement is not provided.0.2.0
clear() => voidFalseClear the current input content.0.2.0
select(placement?: 'start' | 'end') => voidFalseSelect the current input content; for range selection, defaults to the start date if placement is not provided.0.2.0

QuickAccessOption

ts
export type QuickAccessOption = {
	label: string
	key?: string | number | symbol
	targetTime: Date | Date[] | (() => Date | Date[])
	buttonProps?: ButtonProps
}

NumberOrPercentage

ts
export type NumberOrPercentage = number | `${number}%`

RestAttrs

ts
import type { StyleValue } from 'vue'

export type VueClassValue = string | Record<string, any> | VueClassValue[]
export type VueStyleValue = StyleValue

export type RestAttrs = {
	style?: VueStyleValue | null
	class?: VueClassValue | null
	[x: string]: any
}