Skip to content

restrictionRange prop only restricts year, not month #11

Description

@blakeglucas

Expected Behavior The restrictionRange prop of the MonthRangePicker component should restrict the selectable range to the months inside restrictionRange.

Actual Behavior The restrictionRange props only restricts year selection.

To Replicate (ES6 via Webpack and Babel)

import MonthRangePicker from 'react-monthrange-picker'
import moment from 'moment'
import 'moment-range'

<MonthRangePicker
  ref={el => this.monthPicker = el}
  direction="bottom"
  onApply={console.log}
  onCancel={console.log}
  onYearChage={console.log}
  onSelect={console.log}
  selectedDateRange={moment.range(moment(), moment())}
  restrictionRange={moment.range(moment().startOf('year'), moment())} />

I don't know if this is by design, but it seems as though the restriction range should apply to the months as well, like react-dates does with days (https://github.com/airbnb/react-dates). Doesn't seem too hard to implement...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions