I need to convert this:
{object.startDate?== null. <Moment format="MM/DD/YYYY" date={object:startDate}/> : "-----------"}
into something like this:
<DatePicker value={Moment format="MM/DD/YYYY" date={object.startDate}} />
How do I correctly do this?
To use react-moment
it is a must to have moment
installed.
From the docs:
"Use npm to install react-moment along with its peer dependency, moment" https://www.npmjs.com/package/react-moment
import moment from 'moment'
...
<DatePicker value={moment(object.startDate).format('MM/DD/YYYY')} />
...
After installing moment (as stated by Sheldon), this is how it tweaked it to make it work:
<DatePicker value={moment(object.startDate, 'MM/DD/YYYY')} />
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.