const disabledDate: (currentDate: any) => (boolean) = (currentDate) => {
if (clickDate && currentDate) {
// 选择日期跨度最多三月 且不能选择未来日期 今天也不能选择
const endTime = moment(new Date()) < moment(clickDate).add(3, 'M') ? moment().subtract(1, 'days') : moment(clickDate).add(3, 'M')
return (currentDate < moment(clickDate).subtract(3, 'M') || currentDate > endTime);
}
return currentDate && currentDate > moment().subtract(1, 'days');
}
<RangePicker
disabledDate={disabledDate}
/>
本文介绍了一个日期选择器组件中禁用特定日期的逻辑实现。该规则限制了用户只能选择当前日期之前到未来三个月内的日期,并且一次选择的日期范围不能超过三个月。
6686

被折叠的 条评论
为什么被折叠?



