最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to select time with React DatePicker - Stack Overflow

programmeradmin6浏览0评论

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?

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?

Share Improve this question asked Jul 4, 2016 at 7:54 Tuomas ToivonenTuomas Toivonen 23.5k51 gold badges144 silver badges243 bronze badges 1
  • Please post the answer – CodeZombie Commented Apr 2, 2018 at 10:38
Add a ment  | 

2 Answers 2

Reset to default 9

just add showTimeSelect

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

check more examples @ reactdatepicker

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./package/react-date-picker

Original links:

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

发布评论

评论列表(0)

  1. 暂无评论