Hacker0x01 / react-datepicker

A simple and reusable datepicker component for React
https://reactdatepicker.com/
MIT License
7.89k stars 2.23k forks source link

showWeekNumbers with excludeDateIntervals is not working as expected #4902

Closed balajis-qb closed 1 week ago

balajis-qb commented 2 weeks ago

Describe the bug Whenever we disable few week days except the first week day, clicking on the week number is not selecting the corresponding week. However user can still select the enabled week days manually to select that complete week.

To Reproduce Steps to reproduce the behavior:

  1. Set showWeekNumbers prop
  2. Disable any week day other than the first week day (if you enable the first weekday, it'll work)
  3. Try to click the half-disabled week number
  4. It won't select the week

Sample Code to reproduce the issue

() => {
  const [startDate, setStartDate] = useState(new Date("2021/02/22"));
  return (
    <DatePicker
      selected={startDate}
      onChange={(date) => setStartDate(date)}
      dateFormat="I/R"
      locale="en-GB"
      excludeDateIntervals={[
        { start: "2021/02/08", end: "2021/02/10" },
      ]}
      showWeekNumbers
      showWeekPicker
    />
  );
};

Expected behavior It should select the corresponding week even at least one day of the week is enabled.

Screenshots https://github.com/Hacker0x01/react-datepicker/assets/145029139/84523389-1805-4ad1-8aef-71c4a4ab01f1

balajis-qb commented 2 weeks ago

Hi @martijnrusschen , I'll work on this issue. Please assign this to me