How to use the react-dates/lib/utils/isBeforeDay function in react-dates

To help you get started, we’ve selected a few react-dates examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github awethemes / awebooking / assets / babel / calendar.jsx View on Github external
onStartDateChange(e) {
    let startDateString = e.target.value

    let { endDate } = this.state
    const { disabled, minimumNights, isOutsideRange } = this.props

    const startDate = toMomentObject(startDateString, this.getDisplayFormat())
    console.log(startDate)

    const isEndDateBeforeStartDate = startDate
      && isBeforeDay(endDate, startDate.clone().add(minimumNights, 'days'))

    const isStartDateValid = startDate
      && !isOutsideRange(startDate)
      && !(disabled === END_DATE && isEndDateBeforeStartDate)

    if (isStartDateValid) {
      if (isEndDateBeforeStartDate) {
        endDate = null
      }

      this.onDatesChange({ startDate, endDate })
      this.onFocusChange(END_DATE)
    } else {
      this.onDatesChange({
        startDate: null,
        endDate,
github awethemes / awebooking / assets / babel / calendar.jsx View on Github external
onEndDateChange(e) {
    const endDateString = e.target.value

    const { startDate } = this.state
    const { minimumNights, isOutsideRange, keepOpenOnDateSelect } = this.props

    const endDate = toMomentObject(endDateString, this.getDisplayFormat())

    const isEndDateValid = endDate
      && !isOutsideRange(endDate)
      && !(startDate && isBeforeDay(endDate, startDate.clone().add(minimumNights, 'days')))

    if (isEndDateValid) {
      this.onDatesChange({ startDate, endDate })
      if (!keepOpenOnDateSelect) this.onClearFocus()
    } else {
      this.onDatesChange({
        startDate,
        endDate: null,
      })
    }
  }
github telus / tds-community / packages / Calendar / Calendar.jsx View on Github external
          isOutsideRange={day => isBeforeDay(day, moment())}
        />
github telus / tds-community / packages / DatePicker / DatePicker.jsx View on Github external
            isOutsideRange={day => isBeforeDay(day, moment())}
            phrases={getCopy(copyDictionary, copy)}