Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

262
Views
How can I set choosen date as a default date in antd?

I want to set my choosen date as a default date in DatePicker antd.

<DatePicker
    allowClear={false}
    placeholder="Select date"
    onChange={this.changeDate}
    value={moment(this.props.choosenDate)}
/>

How can I do that?

value={moment(this.props.choosenDate) 

it doesn't work

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Here is an example from their documentation.

I think you should be using defaultValue

import { DatePicker, Space } from 'antd';
import moment from 'moment';

const dateFormat = 'YYYY/MM/DD';

...

<DatePicker defaultValue={moment('2015/01/01', dateFormat)} />

about 4 years ago · Juan Pablo Isaza Report

0

You can use default value option.

<DatePicker
    defaultValue = {moment('2015/01/01', 'YYYY/MM/DD')}
    format = {'YYYY/MM/DD'}
/>

https://codesandbox.io/s/dv4mr?file=/index.js:241-251

about 4 years ago · Juan Pablo Isaza Report

0

according to Moment Documents

let yourCustomDate = moment('24/12/2019 09:15:00', "DD MM YYYY hh:mm:ss");


<DatePicker
    allowClear={false}
    placeholder="Select date"
    onChange={this.changeDate}
    value={yourCustomDate}
/>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!