Skip to content Skip to sidebar Skip to footer

How To Select Time With React Datepicker

I'm using React Date Picker and I need also include time to the Date selection. I didn't find any example from documentation how to implement this. Does DatePicker provide any func

Solution 1:

just add showTimeSelect

 <DatePicker
    selected={this.state.startDate}
    onChange={this.handleChange}
    showTimeSelect
    timeFormat="HH:mm"
    timeIntervals={15}
    dateFormat="LLL"
    />

check more examples @ reactdatepicker

Solution 2:

You can use react-date-picker module for a date with a timestamp. You can include the time by including timestamp in your dateFormat property.

E.g.: dateFormat="DD/MM/YYYY HH:mm:ss"

EDIT: Original links are not working anymore. Here's more information about react-date-picker. https://www.npmjs.com/package/react-date-picker

Original links:

http://zippyui.com/docs/react-date-picker/https://github.com/zippyui/react-date-picker/

Post a Comment for "How To Select Time With React Datepicker"