[DatePicker.RangePicker]如何同时添加范围选择和最大日期限制 #1791
Answered
by
vaynevayne
vaynevayne
asked this question in
Q&A
Replies: 1 comment
-
const disabledDate = (_current: any) => {
if (mode === 'date') {
if (duration) {
if (dates && dates.length) {
const tooLate =
dates[0] && Math.abs(_current.diff(dates[0], 'day')) > Number(duration - 1)
const tooEarly =
dates[1] && Math.abs(dates[1].diff(_current, 'day')) > Number(duration - 1)
return tooEarly || tooLate || (_current && _current > moment().endOf('day'))
}
return _current && _current > moment().endOf('day')
}
return _current && _current > moment().endOf('day')
}
if (mode === 'month') {
return _current && _current > moment().endOf('month')
}
}
disabledDate={disabledDate}
clearRangeOnReselect |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
vaynevayne
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
需求: 只能选择7天范围内, 以及最大时间是今天,
如下写法回导致, 重新点击修改起始时间时,整个面板会被禁用,导致无法继续操作
Beta Was this translation helpful? Give feedback.
All reactions