Tag Archives: antdv: DatePicker error

[antdv: DatePicker] `value` provides invalidate moment time. If you want set empty value, use `null`

[antdv: DatePicker] `value` provides invalidate moment time. If you want set empty value,use `null`

Always encounter this problem

Normal use:

html:
 <a-month-picker v-model="monthValue"  :allowClear="false" type="month" placeholder="选择月"></a-month-picker>
data:
monthValue:moment().format('YYYY-MM')

Reason:
ant design vue datepicker needs the format of moment by default, so an error will be reported.

Solution: use following method to define the data:

 monthValue: moment(new Date(), 'YYYY-MM')