Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maxDate attribute can be bypassed from end user in DateRangePicker #627

Open
mCharatz opened this issue Nov 30, 2023 · 0 comments
Open

maxDate attribute can be bypassed from end user in DateRangePicker #627

mCharatz opened this issue Nov 30, 2023 · 0 comments

Comments

@mCharatz
Copy link

maxDate attribute can be bypassed from end user in DateRangePicker

Selecting a date range in DateRangePicker by using the 'days starting today' option from the UI selects the disabled dates beyond the setted maxDate

[BUG] Bug Reproduce Steps

Step1) Use a DateRangePicker like this with maxDate initialized

const [state, setState] = useState([
  {
    startDate: new Date(),
    endDate: addDays(new Date(), 7),
    key: 'selection'
  }
]);

<DateRangePicker
  onChange={item => setState([item.selection])}
  showSelectionPreview={true}
  moveRangeOnFirstSelection={false}
  months={2}
  ranges={state}
  direction="horizontal"
  maxDate={new Date()}
/>;

Step2)

Use the 'days starting today' from the rendered UI and choose some days forward. You can see that the DateRangePicker selects the disabled dates in the future

[BUG] Expected behaviour

When maxDate is setted it was supposed not to be able to select dates after maxDate

Environment

Package Version: 1.4.0
React version: 18.2.0
Node version: 18.14.0
Browser: Mozila Firefox, Chrome

umakantp added a commit to umakantp/react-date-range that referenced this issue Dec 29, 2023
umakantp added a commit to umakantp/react-date-range that referenced this issue Dec 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant