Tag Archives: ant-design a-date-picker Error

[Solved] ant-design a-date-picker Error: date.locale is not a function

The error reporting contents are as follows:

date.locale is not a function

Original code:

<a-form-item label="Time From:" name="signTime">
                <a-date-picker placeholder="Please Select"  v-model:value="formState.signTime" style="width:100%" />
              </a-form-item>

Correct code:

<a-form-item label="Time From:" name="signTime">
                <a-date-picker placeholder="Please Select" format="YYYY-MM-DD" valueFormat="YYYY-MM-DD" v-model:value="formState.signTime" style="width:100%" />
              </a-form-item>

Summary: you need to add the time display format attribute and the final value format valueFormat attribute.