Beginner with ReactJS, I use now the wonderful ReactJS Datepicker. Questions about my custom date format :
Here is my code :
<DatePicker
selected={this.state.startDate}
onChange={this.handleChange}
locale={fr}
showTimeSelect
timeFormat="HH:mm"
timeIntervals={60}
dateFormat="dddd, DDD, ddd, d, dd MMMM yyyy à HH'h'mm"
timeCaption="Heure"
minDate={new Date()}
showDisabledMonthNavigation
placeholderText="Choisir ici ..."
excludeTimes={[0, 1, 2, 3, 4]}
/>
Date shown in input field is then :
0023, 082, 023, 23, 23 mars 2019 à 20h00
Thanks
React datepicker uses Moment.js for dates, I think you should review the docs at his website.
For example MMMM Do YYYY, h:mm:ss a
should return a date formated as March 21st 2019, 8:50:37 am
.
EDIT
I went to the repo and it appears the author removed moment from package, so I gave a try to the formatting dates guide found here and it appears to be working now! Per example use "eeee" if you want day of the week.
I made a working example at codesandbox.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With