如何使用React DatePicker选择时间 [英] How to select time with React DatePicker

查看:50
本文介绍了如何使用React DatePicker选择时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用反应日期选择器,并且我还需要在日期"选择中添加时间.我没有从文档中找到任何如何实现此示例的示例.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?

推荐答案

只需添加 showTimeSelect

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

检查更多示例@ reactdatepicker

这篇关于如何使用React DatePicker选择时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆