Commit 9b4a929a authored by XieZhiXiong's avatar XieZhiXiong

chore: 恢复代码

parent b8b19332
...@@ -66,14 +66,21 @@ const RangeTime: React.FC<Iprops> = (props: Iprops) => { ...@@ -66,14 +66,21 @@ const RangeTime: React.FC<Iprops> = (props: Iprops) => {
}; };
const getDisableDate = useCallback((current: Moment, mode: "startTime" | "endTime") => { const getDisableDate = useCallback((current: Moment, mode: "startTime" | "endTime") => {
const { startTime, endTime } = innerRangeTime; const reverseMode = mode === 'startTime' ? 'endTime' : 'startTime';
const modeTime: Moment | null = innerRangeTime[reverseMode];
// current 为当前日历上的日期, 如果返回值为true,那么表示当前日期为禁用状态 // current 为当前日历上的日期, 如果返回值为true,那么表示当前日期为禁用状态
if (!modeTime) {
if (shouldGtCurrent) {
return current < currentDay.endOf(endOfUnit);
}
return false;
}
if (mode === 'startTime') { if (mode === 'startTime') {
return shouldGtCurrent ? current <= endTime || current <= currentDay : false; return shouldGtCurrent ? (current < currentDay.endOf(endOfUnit) || current > (modeTime as Moment).endOf(endOfUnit)) : current > (modeTime as Moment).endOf(endOfUnit);
} else { } else {
//现在的时间要大于开始的时间, true 为禁用 //现在的时间要大于开始的时间, true 为禁用
return shouldGtCurrent ? current < startTime || current <= currentDay : false; return shouldGtCurrent ? (current < currentDay.endOf(endOfUnit) || current < (modeTime as Moment).endOf(endOfUnit)) : current < (modeTime as Moment).endOf(endOfUnit);
} }
}, [innerRangeTime]); }, [innerRangeTime]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment