[英]React year picker with min max range
Is there any react year picker which will only pick a year from a given range of the year.是否有任何反应年份选择器只能从一年的给定范围中选择一年。 If so, how can I do it.
如果是这样,我该怎么做。 I have tried react-datetime.
我试过反应日期时间。 But I couldn't set the range of the year.
但是我无法设置年份的范围。
<Datetime min={1800} max={2020} dateFormat="YYYY" timeFormat={false} onChange={(date) => this.onChangeExactYear(date)}/>
You should use isValidDate
prop ( https://github.com/arqex/react-datetime#blocking-some-dates-to-be-selected )您应该使用
isValidDate
道具( https://github.com/arqex/react-datetime#blocking-some-dates-to-be-selected )
const isValidDate = current => {
const year = current.year();
return year >= 1800 && year <= 2020;
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.