search

Home  >  Q&A  >  body text

ant.design v5.2.0 - date.locale is not a function rewritten as: "ant.design v5.2.0 - date.locale is not a callable function"

<p>I have the following question:</p> <p>I'm using version 5.2.0 of ant.design. When I use the <code><DatePicker></code> component using: </p> ; <p>If I don't specify the default value as dayjs <code><form></code>, I don't get the error, but I don't get the prepopulated value in the date picker either. </p> <p>What else can I try? </p> <p>This is an excerpt from the source code:</p> <pre class="brush:php;toolbar:false;"><Form form={formRef} onFinish={handleSubmit} initialValues={{...collaboration, dueDate: dayjs(collaboration.dueDate)}} > <Form.Item label="DatePicker" name={"dueDate"} rules={[{ required: true, message: 'Please select time!' }]}> <DatePicker style={{width: "100%"}}/> </Form.Item> </Form></pre>
P粉488464731P粉488464731464 days ago555

reply all(1)I'll reply

  • P粉242126786

    P粉2421267862023-08-26 00:52:57

    This is a sandbox for this case: https://codesandbox.io/s/antd-reproduction-template-forked-4mv33s?file=/index.js

    edit: Works fine in sandbox :D

    reply
    0
  • Cancelreply