antd DatePicker框日期限制
disabledDate = (current, type) => {
const {
stepTwoData: { fullDurationStartDate, fullDurationEndDate },
} = this.state;
if (type === 'start') {
return current.valueOf() > moment(fullDurationEndDate).valueOf();
}
if(type === 'end') {
return current.valueOf() < moment(fullDurationStartDate).valueOf();
}
return current && current < moment().endOf('day');
};
两个日期之间用或
disabledDate = (current, type) => {
const {
stepThreeData: { diffDurationStartDate, diffDurationEndDate },
allData,
} = this.state;
if (type === 'start') {
return current.valueOf() <= moment(allData.fullDurationStartDate).valueOf() ||
current.valueOf() > moment(diffDurationEndDate).valueOf();
}
if(type === 'end'){
return current.valueOf() < moment(diffDurationStartDate).valueOf();
}
return current < moment(allData.fullOnceDatetime).valueOf();
};

浙公网安备 33010602011771号