Skip to content

[DatePicker.RangePicker]如何同时添加范围选择和最大日期限制 #1791

Answered by vaynevayne
vaynevayne asked this question in Q&A
Discussion options

You must be logged in to vote
  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')
    }
  }


 disabl…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by vaynevayne
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant