Skip to content

Issue with onInvalidChange and minDate/maxDate #702

@parkm

Description

@parkm

Before you start - checklist

  • I followed instructions in documentation written for my React-Date-Picker version
  • I have checked if this bug is not already reported

Description

When using minDate/maxDate and manually typing in the value for month/day/year, onInvalidChange will get called yet the value of the input shown is valid.

Steps to reproduce

  1. Go to https://codesandbox.io/p/sandbox/jovial-ioana-srq44p
  2. Set the date to the latest valid date
  3. Select the day input and type in a day ahead to make the date invalid
  4. Notice that the input auto corrects itself to a valid day but the onInvalidChange callback gets called resulting in an incorrect error message

Expected behavior

onInvalidChange should only call when the resulting value is invalid

Actual behavior

onInvalidChange gets called when the resulting value is valid

Additional information

No response

Environment

Chrome 138.0.7204.170
v11.0.0 of react-date-picker

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstale

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions