Tuomas Toivonen
Tuomas Toivonen

Reputation: 23472

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 functionality for this out of box, or do I have to customize it myself?

Upvotes: 5

Views: 34223

Answers (2)

Vaishnavi RSH
Vaishnavi RSH

Reputation: 11

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/

Upvotes: 1

Habiba
Habiba

Reputation: 143

just add showTimeSelect

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

check more examples @ reactdatepicker

Upvotes: 9

Related Questions