Skip to content

Month picker doesn't disable all months before minDate  #1765

@MAKoski

Description

@MAKoski

Using showMonthYearPicker, the minDate and maxDate props gray out the correct months as long as they're in the same year. But if your maxDate is in the next year (2020 for this example), only the top row of months (Jan - Mar) gray out even if your minDate is after April. maxDate correctly grays out the months that follow.

Example component:
<ReactDatePicker dateFormat='MMM-yyyy' selected={new Date('06-04-2019')} minDate={new Date('06-01-2019')} maxDate={new Date('03-01-2020')} showMonthYearPicker />

Expected behavior

This should gray out the months Jan - May 2019
expected

Actual behavior

Even though the minDate is June, months April and May look selectable, but are not, and do not have the class react-datepicker__month--disabled
actual

I have a PR I'll open shortly for this issue and link back

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions