Riz*_*a S 4 datepicker react-day-picker react-datepicker
如何设置最大或最小日期?例如,我只想限制过去2个月(最小日期)直到今天(最大日期)的日间收盘者。因此用户无法选择明天的日期。谢谢
您需要使用该disabledDays属性。它可以传递一组修饰符,如http://react-day-picker.js.org/docs/modifiers中所述
以下应满足您的需求:
var twoMonthsAgo = new Date();
twoMonthsAgo.setMonth(twoMonthsAgo.getMonth() - 2);
<DayPicker disabledDays={
{
before: twoMonthsAgo,
after: new Date()
}} />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5743 次 |
| 最近记录: |