You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By clicking the input box, you can select a date from a popup calendar.
API
There are five kinds of picker:
DatePicker
DatePicker[picker="month"]
DatePicker[picker="week"]
DatePicker[picker="year"]
DatePicker[picker="quarter"]
RangePicker
Localization
The default locale is en-US, if you need to use other languages, recommend to use internationalized components provided by us at the entrance. Look at: ConfigProvider.
If there are special needs (only modifying single component language), Please use the property: local. Example: default.
<template><a-config-provider:locale="locale"><a-date-pickerv-model:value="value" /></a-config-provider></template><script>// The default locale is en-US, if you want to use other locale, just set locale in entry file globally.importdayjsfrom'dayjs';import'dayjs/locale/zh-cn';importlocalefrom'ant-design-vue/es/date-picker/locale/zh_CN';import{defineComponent}from'vue';dayjs.locale('zh-cn');exportdefaultdefineComponent({setup(){return{value: dayjs('2015-01-01','YYYY-MM-DD')dayjs,
locale
};},});</script>
Common API
The following APIs are shared by DatePicker, RangePicker.
Property
Description
Type
Default
Version
allowClear
Whether to show clear button
boolean
true
autofocus
If get focus when component mounted
boolean
false
bordered
Whether has border style
boolean
true
dateRender
Custom rendering function for date cells
v-slot:dateRender="{current, today}"
-
disabled
Determine whether the DatePicker is disabled
boolean
false
disabledDate
Specify the date that cannot be selected
(currentDate: dayjs) => boolean
-
dropdownClassName
To customize the className of the popup calendar
string
-
getPopupContainer
To set the container of the floating layer, while the default is to create a div element in body
function(trigger)
-
inputReadOnly
Set the readonly attribute of the input tag (avoids virtual keyboard on touch devices)
To set the date format, refer to dayjs. When an array is provided, all values are used for parsing and first value is used for formatting, support Custom Format