简体   繁体   中英

Antd Datepicker date format

I'm receiving data from API and passing it immediatly to <Form> initialValue . But registerDate is in string format like "01-01-2022" and when <Form.Item> is passing it into <DatePicker> i've got an error:

Error: t.clone is not a function [...]

How can I repair it? Can I format the date before passing it into <Datepicker> in <Form.Item> ?

Code example here: https://stackblitz.com/edit/react-cxyphe

It looks like the name in Form.Item is causing the problem. If you remove name from line 20 it should render the datePicker. AntD also some examples of using a date picker in a form.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM