Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.

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

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

Comments

@mcharatzoglou
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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant