Repository: Hacker0x01/react-datepicker (ts)

Issue:
Disabled date is getting auto-selected when switching to the other view like next month or year
**Describe the bug**
In our DatePicker, once we select a date and switch to the next or previous month/year view, by default the auto-focus has been set to the same date or month, which will help the user from continue the focus from the same date or month using keyboard keys.  But in the next view if the same date or month is the part of a disabled dates (using excludeDate or maxDate or minDate or some other props like that), in that case the keyboard focus has been auto-set to those disabled dates, which shouldn't be the case I think, because when we normally use keyboard arrows to navigate between the available dates we won't to be able to focus on the disabled dates.

**To Reproduce**
Steps to reproduce the behavior:

1. Try the following code
```
() => {
  const [startDate, setStartDate] = useState(new Date("2024-05-08"));
  return (
    <DatePicker
      selected={startDate}
      onChange={(date) => setStartDate(date)}
      excludeDates={[new Date("2024-04-08")]}
    />
  );
};
```
2. Here I selected the 08th May, 2024 by default
3. Click the date picker input & switch to the previous month, where I excluded the same date of April
4. But you can notice, the default highlight style is applied for that disabled date also

This issue can be recreated in the month view or quarter year view or even in the year view (Here in the year view, we track the same position instead of the actual date while switching between next/previous view.  So trying to exclude the year of the same position, we can recreate it in the year view) 

In the following example of the year picker, I selected 2023 (year located in the 3rd row, 1st col) and when I click the next arrow (where I disable the year in the same location), I can still see it's auto selected.  Check the attached screenshots and the code for more details

```
() => {
  const [startDate, setStartDate] = useState(new Date("2023-04-08"));
  return (
    <DatePicker
      selected={startDate}
      onChange={(date) => setStartDate(date)}
      showYearPicker
      excludeDates={[new Date("2035-06-24")]}
      dateFormat="yyyy"
    />
  );
};
```



![image](https://github.com/Hacker0x01/react-datepicker/assets/145029139/354a8184-e276-41be-a15c-2c60ffd91fcd)
![image](https://github.com/Hacker0x01/react-datepicker/assets/145029139/ec3fed57-77d9-41f3-849d-57ed876e47b0)

Pull request:
Fix #4933: 🐛Remove the auto set of the '--keyboard-selected' class from the disabled dates while switching to the next or the previous view
Closes #4933

**Problem**
As I mentioned in the issue, when the auto-selected date (which is the currently selected) is part of a disabled date in the next or previous month/year view, while switching still it'll set highlight the disabled dates.  In this PR I removed the auto-setting of the class '--keyboard-selected' while switching to the previous/next view if the corresponding date is disabled.

## Contribution checklist
- [x] I have followed the [contributing guidelines](https://github.com/Hacker0x01/react-datepicker/blob/main/CONTRIBUTING.md).
- [x] I have added sufficient test coverage for my changes.
- [x] I have formatted my code with Prettier and checked for linting issues with ESLint for code readability.


Patch:
diff --git a/docs-site/package.json b/docs-site/package.json
index f929374e..5f727092 100644
--- a/docs-site/package.json
+++ b/docs-site/package.json
@@ -6,7 +6,7 @@
     "highlight.js": "^11.9.0",
     "react": "^18.3.1",
     "react-dom": "^18.3.1",
-    "react-live": "^4.1.7"
+    "react-live": "^4.1.6"
   },
   "scripts": {
     "start": "react-app-rewired start",
diff --git a/docs-site/src/components/App/index.js b/docs-site/src/components/App/index.js
index 8f57e3a8..68f796d8 100644
--- a/docs-site/src/components/App/index.js
+++ b/docs-site/src/components/App/index.js
@@ -73,10 +73,10 @@ const Root = () => (
             className="badge"
           />
         </a>
-        <a href="https://codecov.io/gh/Hacker0x01/react-datepicker">
+        <a href="https://david-dm.org/Hacker0x01/react-datepicker">
           <img
-            src="https://codecov.io/gh/Hacker0x01/react-datepicker/branch/main/graph/badge.svg"
-            alt="codecov"
+            src="https://david-dm.org/Hacker0x01/react-datepicker.svg"
+            alt="Dependency status badge"
             className="badge"
           />
         </a>
diff --git a/docs-site/src/components/Examples/index.js b/docs-site/src/components/Examples/index.js
index f795d0f9..3b4716ef 100644
--- a/docs-site/src/components/Examples/index.js
+++ b/docs-site/src/components/Examples/index.js
@@ -104,7 +104,6 @@ import CalendarStartDay from "../../examples/calendarStartDay";
 import ExternalForm from "../../examples/externalForm";
 import CalendarIcon from "../../examples/calendarIcon";
 import SelectsMultiple from "../../examples/selectsMultiple";
-import SelectsMultipleMonths from "../../examples/selectsMultipleMonths";
 import CalendarIconExternal from "../../examples/calendarIconExternal";
 import CalendarIconSvgIcon from "../../examples/calendarIconSvgIcon";
 import ToggleCalendarOnIconClick from "../../examples/toggleCalendarOnIconClick";
@@ -503,10 +502,6 @@ export default class exampleComponents extends React.Component {
       title: "Select multiple dates",
       component: SelectsMultiple,
     },
-    {
-      title: "Select multiple months",
-      component: SelectsMultipleMonths,
-    },
     {
       title: "Strict parsing",
       component: StrictParsing,
diff --git a/docs-site/src/examples/selectsMultipleMonths.js b/docs-site/src/examples/selectsMultipleMonths.js
deleted file mode 100644
index ac2a694a..00000000
--- a/docs-site/src/examples/selectsMultipleMonths.js
+++ /dev/null
@@ -1,17 +0,0 @@
-() => {
-  const [selectedDates, setSelectedDates] = useState([new Date()]);
-  const onChange = (dates) => {
-    setSelectedDates(dates);
-  };
-  return (
-    <DatePicker
-      selectedDates={selectedDates}
-      selectsMultiple
-      showMonthYearPicker
-      show
-      onChange={onChange}
-      shouldCloseOnSelect={false}
-      disabledKeyboardNavigation
-    />
-  );
-};
diff --git a/docs-site/yarn.lock b/docs-site/yarn.lock
index 77e54846..0d741cad 100644
--- a/docs-site/yarn.lock
+++ b/docs-site/yarn.lock
@@ -4653,6 +4653,18 @@ glob-to-regexp@^0.4.1:
   resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e"
   integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==
 
+glob@7.1.6:
+  version "7.1.6"
+  resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
+  integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
+  dependencies:
+    fs.realpath "^1.0.0"
+    inflight "^1.0.4"
+    inherits "2"
+    minimatch "^3.0.4"
+    once "^1.3.0"
+    path-is-absolute "^1.0.0"
+
 glob@^10.3.10:
   version "10.3.10"
   resolved "https://registry.yarnpkg.com/glob/-/glob-10.3.10.tgz#0351ebb809fd187fe421ab96af83d3a70715df4b"
@@ -7458,10 +7470,10 @@ react-is@^18.0.0:
   resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b"
   integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==
 
-react-live@^4.1.7:
-  version "4.1.7"
-  resolved "https://registry.yarnpkg.com/react-live/-/react-live-4.1.7.tgz#a451054bee78e6c9b4410dfc3940b318d9bc7880"
-  integrity sha512-NTzl0POOAW3dkp7+QL30duOrIu2Vzf2LHdx4TaQ0BqOAtQcSTKEXujfm9jR2VoCHko0oi35PYp38yKQBXz4mrg==
+react-live@^4.1.6:
+  version "4.1.6"
+  resolved "https://registry.yarnpkg.com/react-live/-/react-live-4.1.6.tgz#6d9b7d381bd2b359ca859767501135112b6bab33"
+  integrity sha512-2oq3MADi3rupqZcdoHMrV9p+Eg/92BDds278ZuoOz8d68qw6ct0xZxX89MRxeChrnFHy1XPr8BVknDJNJNdvVw==
   dependencies:
     prism-react-renderer "^2.0.6"
     sucrase "^3.31.0"
@@ -8292,7 +8304,7 @@ stylehacks@^5.1.1:
     browserslist "^4.21.4"
     postcss-selector-parser "^6.0.4"
 
-sucrase@^3.31.0, sucrase@^3.32.0:
+sucrase@^3.31.0:
   version "3.35.0"
   resolved "https://registry.yarnpkg.com/sucrase/-/sucrase-3.35.0.tgz#57f17a3d7e19b36d8995f06679d121be914ae263"
   integrity sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==
@@ -8305,6 +8317,19 @@ sucrase@^3.31.0, sucrase@^3.32.0:
     pirates "^4.0.1"
     ts-interface-checker "^0.1.9"
 
+sucrase@^3.32.0:
+  version "3.32.0"
+  resolved "https://registry.yarnpkg.com/sucrase/-/sucrase-3.32.0.tgz#c4a95e0f1e18b6847127258a75cf360bc568d4a7"
+  integrity sha512-ydQOU34rpSyj2TGyz4D2p8rbktIOZ8QY9s+DGLvFU1i5pWJE8vkpruCjGCMHsdXwnD7JDcS+noSwM/a7zyNFDQ==
+  dependencies:
+    "@jridgewell/gen-mapping" "^0.3.2"
+    commander "^4.0.0"
+    glob "7.1.6"
+    lines-and-columns "^1.1.6"
+    mz "^2.7.0"
+    pirates "^4.0.1"
+    ts-interface-checker "^0.1.9"
+
 supports-color@^5.3.0:
   version "5.5.0"
   resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
diff --git a/examples/hello-world/package.json b/examples/hello-world/package.json
index ba165be6..8aabf86e 100644
--- a/examples/hello-world/package.json
+++ b/examples/hello-world/package.json
@@ -4,7 +4,7 @@
   "private": true,
   "dependencies": {
     "react": "^18.3.1",
-    "react-datepicker": "^7.2.0",
+    "react-datepicker": "^7.1.0",
     "react-dom": "^18.3.1",
     "react-scripts": "5.0.1"
   },
diff --git a/examples/hello-world/yarn.lock b/examples/hello-world/yarn.lock
index fa0ae456..686877a6 100644
--- a/examples/hello-world/yarn.lock
+++ b/examples/hello-world/yarn.lock
@@ -7340,10 +7340,10 @@ react-app-polyfill@^3.0.0:
     regenerator-runtime "^0.13.9"
     whatwg-fetch "^3.6.2"
 
-react-datepicker@^7.2.0:
-  version "7.2.0"
-  resolved "https://registry.yarnpkg.com/react-datepicker/-/react-datepicker-7.2.0.tgz#2d430caebb5c8b0fb988286d004aa2676ace665f"
-  integrity sha512-Hhs1Fk6/ZqpGGg9QX/JjzvgEJoSFKYCAvRVdBbjxvOjflsXutFprAl/E0ZOm1J+/b/jQqU03WMTTNLcw5nXcuw==
+react-datepicker@^7.1.0:
+  version "7.1.0"
+  resolved "https://registry.yarnpkg.com/react-datepicker/-/react-datepicker-7.1.0.tgz#d800b63d1598a01f9a7bcceac6ae30ca3eea9aa6"
+  integrity sha512-Z91n5ybhmzI+YChj1ZG7ntPPOmHR2Dh4jbIl+mNgKXKoxyzUQBh7M3eQaFOwrBCVdKy5vsj370/ocQlGu1qsGA==
   dependencies:
     "@floating-ui/react" "^0.26.2"
     clsx "^2.1.0"
diff --git a/package.json b/package.json
index 3bb8e9a4..6b5268ca 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
   "author": "HackerOne",
   "name": "react-datepicker",
   "description": "A simple and reusable datepicker component for React",
-  "version": "7.2.0",
+  "version": "7.1.0",
   "license": "MIT",
   "homepage": "https://github.com/Hacker0x01/react-datepicker",
   "main": "dist/index.js",
diff --git a/src/day.tsx b/src/day.tsx
index 3d8f929e..ecb40ce4 100644
--- a/src/day.tsx
+++ b/src/day.tsx
@@ -188,13 +188,20 @@ export default class Day extends Component<DayProps> {
       ? this.props.selectedDates?.some((date) => this.isSameDayOrWeek(date))
       : this.isSameDayOrWeek(this.props.selected);
 
-    return !isSelectedDate && this.isSameDayOrWeek(this.props.preSelection);
+    const isDisabled =
+      this.props.preSelection && this.isDisabled(this.props.preSelection);
+
+    return (
+      !isSelectedDate &&
+      this.isSameDayOrWeek(this.props.preSelection) &&
+      !isDisabled
+    );
   };
 
-  isDisabled = () =>
+  isDisabled = (day = this.props.day) =>
     // Almost all props previously were passed as this.props w/o proper typing with prop-types
     // after the migration to TS i made it explicit
-    isDayDisabled(this.props.day, {
+    isDayDisabled(day, {
       minDate: this.props.minDate,
       maxDate: this.props.maxDate,
       excludeDates: this.props.excludeDates,
diff --git a/src/index.tsx b/src/index.tsx
index 7a385a85..d04ba080 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -66,8 +66,6 @@ export { registerLocale, setDefaultLocale, getDefaultLocale };
 const outsideClickIgnoreClass = "react-datepicker-ignore-onclickoutside";
 const WrappedCalendar = onClickOutside(Calendar);
 
-export { ReactDatePickerCustomHeaderProps } from "./calendar";
-
 // Compares dates year+month combinations
 function hasPreSelectionChanged(
   date1?: Date | null,
diff --git a/src/month.tsx b/src/month.tsx
index f4be57db..1624bfd6 100644
--- a/src/month.tsx
+++ b/src/month.tsx
@@ -403,11 +403,6 @@ export default class Month extends Component<MonthProps> {
   isSelectedMonth = (day: Date, m: number, selected: Date) =>
     getMonth(selected) === m && getYear(day) === getYear(selected);
 
-  isSelectMonthInList = (day: Date, m: number, selectedDates: Date[]) =>
-    selectedDates.some((selectedDate) =>
-      this.isSelectedMonth(day, m, selectedDate),
-    );
-
   isSelectedQuarter = (day: Date, q: number, selected: Date): boolean =>
     getQuarter(day) === q && getYear(day) === getYear(selected);
 
@@ -784,42 +779,26 @@ export default class Month extends Component<MonthProps> {
     return isDisabled;
   };
 
-  getSelection() {
-    const { selected, selectedDates, selectsMultiple } = this.props;
-
-    if (selectsMultiple) {
-      return selectedDates;
-    }
-
-    if (selected) {
-      return [selected];
-    }
-
-    return undefined;
-  }
-
   getMonthClassNames = (m: number) => {
-    const { day, startDate, endDate, preSelection, monthClassName } =
+    const { day, startDate, endDate, selected, preSelection, monthClassName } =
       this.props;
     const _monthClassName = monthClassName
       ? monthClassName(setMonth(day, m))
       : undefined;
-
-    const selection = this.getSelection();
-
     return clsx(
       "react-datepicker__month-text",
       `react-datepicker__month-${m}`,
       _monthClassName,
       {
         "react-datepicker__month-text--disabled": this.isMonthDisabled(m),
-        "react-datepicker__month-text--selected": selection
-          ? this.isSelectMonthInList(day, m, selection)
+        "react-datepicker__month-text--selected": selected
+          ? this.isSelectedMonth(day, m, selected)
           : undefined,
         "react-datepicker__month-text--keyboard-selected":
           !this.props.disabledKeyboardNavigation &&
           preSelection &&
-          this.isSelectedMonth(day, m, preSelection),
+          this.isSelectedMonth(day, m, preSelection) &&
+          !this.isMonthDisabled(m),
         "react-datepicker__month-text--in-selecting-range":
           this.isInSelectingRangeMonth(m),
         "react-datepicker__month-text--in-range":
@@ -887,9 +866,17 @@ export default class Month extends Component<MonthProps> {
       selected,
       minDate,
       maxDate,
+      excludeDates,
+      includeDates,
+      filterDate,
       preSelection,
       disabledKeyboardNavigation,
     } = this.props;
+
+    const isDisabled =
+      (minDate || maxDate || excludeDates || includeDates || filterDate) &&
+      isQuarterDisabled(setQuarter(day, q), this.props);
+
     return clsx(
       "react-datepicker__quarter-text",
       `react-datepicker__quarter-${q}`,
@@ -903,7 +890,8 @@ export default class Month extends Component<MonthProps> {
         "react-datepicker__quarter-text--keyboard-selected":
           !disabledKeyboardNavigation &&
           preSelection &&
-          this.isSelectedQuarter(day, q, preSelection),
+          this.isSelectedQuarter(day, q, preSelection) &&
+          !isDisabled,
         "react-datepicker__quarter-text--in-selecting-range":
           this.isInSelectingRangeQuarter(q),
         "react-datepicker__quarter-text--in-range":
diff --git a/src/year.tsx b/src/year.tsx
index 551e63d5..a382691c 100644
--- a/src/year.tsx
+++ b/src/year.tsx
@@ -222,12 +222,21 @@ export default class Year extends Component<YearProps> {
     ) {
       return;
     }
+
+    const { minDate, maxDate, excludeDates, includeDates, filterDate } =
+      this.props;
+
     const date = getStartOfYear(setYear(this.props.date, y));
+    const isDisabled =
+      (minDate || maxDate || excludeDates || includeDates || filterDate) &&
+      isYearDisabled(y, this.props);
+
     return (
       !this.props.disabledKeyboardNavigation &&
       !this.props.inline &&
       !isSameDay(date, getStartOfYear(this.props.selected)) &&
-      isSameDay(date, getStartOfYear(this.props.preSelection))
+      isSameDay(date, getStartOfYear(this.props.preSelection)) &&
+      !isDisabled
     );
   };
 
diff --git a/yarn.lock b/yarn.lock
index d152f702..418166e0 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2012,9 +2012,9 @@
   integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==
 
 "@types/node@*", "@types/node@20":
-  version "20.14.9"
-  resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.9.tgz#12e8e765ab27f8c421a1820c99f5f313a933b420"
-  integrity sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==
+  version "20.14.5"
+  resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.5.tgz#fe35e3022ebe58b8f201580eb24e1fcfc0f2487d"
+  integrity sha512-aoRR+fJkZT2l0aGOJhuA8frnCSoNX6W7U2mpNq63+BxBIj5BQFt8rHy627kijCmm63ijdSdwvGgpUsU6MBsZZA==
   dependencies:
     undici-types "~5.26.4"
 
@@ -2084,61 +2084,61 @@
     "@types/yargs-parser" "*"
 
 "@typescript-eslint/eslint-plugin@^7.9.0":
-  version "7.14.1"
-  resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.14.1.tgz#90e2f76a5930d553ede124e1f541a39b4417465e"
-  integrity sha512-aAJd6bIf2vvQRjUG3ZkNXkmBpN+J7Wd0mfQiiVCJMu9Z5GcZZdcc0j8XwN/BM97Fl7e3SkTXODSk4VehUv7CGw==
+  version "7.13.1"
+  resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.13.1.tgz#cdc521c8bca38b55585cf30db787fb2abad3f9fd"
+  integrity sha512-kZqi+WZQaZfPKnsflLJQCz6Ze9FFSMfXrrIOcyargekQxG37ES7DJNpJUE9Q/X5n3yTIP/WPutVNzgknQ7biLg==
   dependencies:
     "@eslint-community/regexpp" "^4.10.0"
-    "@typescript-eslint/scope-manager" "7.14.1"
-    "@typescript-eslint/type-utils" "7.14.1"
-    "@typescript-eslint/utils" "7.14.1"
-    "@typescript-eslint/visitor-keys" "7.14.1"
+    "@typescript-eslint/scope-manager" "7.13.1"
+    "@typescript-eslint/type-utils" "7.13.1"
+    "@typescript-eslint/utils" "7.13.1"
+    "@typescript-eslint/visitor-keys" "7.13.1"
     graphemer "^1.4.0"
     ignore "^5.3.1"
     natural-compare "^1.4.0"
     ts-api-utils "^1.3.0"
 
 "@typescript-eslint/parser@^7.9.0":
-  version "7.14.1"
-  resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-7.14.1.tgz#13d97f357aed3c5719f259a6cc3d1a1f065d3692"
-  integrity sha512-8lKUOebNLcR0D7RvlcloOacTOWzOqemWEWkKSVpMZVF/XVcwjPR+3MD08QzbW9TCGJ+DwIc6zUSGZ9vd8cO1IA==
-  dependencies:
-    "@typescript-eslint/scope-manager" "7.14.1"
-    "@typescript-eslint/types" "7.14.1"
-    "@typescript-eslint/typescript-estree" "7.14.1"
-    "@typescript-eslint/visitor-keys" "7.14.1"
+  version "7.13.1"
+  resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-7.13.1.tgz#fac57811b3e519185f7259bac312291f7b9c4e72"
+  integrity sha512-1ELDPlnLvDQ5ybTSrMhRTFDfOQEOXNM+eP+3HT/Yq7ruWpciQw+Avi73pdEbA4SooCawEWo3dtYbF68gN7Ed1A==
+  dependencies:
+    "@typescript-eslint/scope-manager" "7.13.1"
+    "@typescript-eslint/types" "7.13.1"
+    "@typescript-eslint/typescript-estree" "7.13.1"
+    "@typescript-eslint/visitor-keys" "7.13.1"
     debug "^4.3.4"
 
-"@typescript-eslint/scope-manager@7.14.1":
-  version "7.14.1"
-  resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-7.14.1.tgz#63de7a577bc6fe8ee6e412a5b85499f654b93ee5"
-  integrity sha512-gPrFSsoYcsffYXTOZ+hT7fyJr95rdVe4kGVX1ps/dJ+DfmlnjFN/GcMxXcVkeHDKqsq6uAcVaQaIi3cFffmAbA==
+"@typescript-eslint/scope-manager@7.13.1":
+  version "7.13.1"
+  resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-7.13.1.tgz#c08041206904bf36f0e6997efdb0ca775e0c452e"
+  integrity sha512-adbXNVEs6GmbzaCpymHQ0MB6E4TqoiVbC0iqG3uijR8ZYfpAXMGttouQzF4Oat3P2GxDVIrg7bMI/P65LiQZdg==
   dependencies:
-    "@typescript-eslint/types" "7.14.1"
-    "@typescript-eslint/visitor-keys" "7.14.1"
+    "@typescript-eslint/types" "7.13.1"
+    "@typescript-eslint/visitor-keys" "7.13.1"
 
-"@typescript-eslint/type-utils@7.14.1":
-  version "7.14.1"
-  resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-7.14.1.tgz#c183f2f28c4c8578eb80aebc4ac9ace400160af6"
-  integrity sha512-/MzmgNd3nnbDbOi3LfasXWWe292+iuo+umJ0bCCMCPc1jLO/z2BQmWUUUXvXLbrQey/JgzdF/OV+I5bzEGwJkQ==
+"@typescript-eslint/type-utils@7.13.1":
+  version "7.13.1"
+  resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-7.13.1.tgz#63bec3f1fb43cf0bc409cbdb88ef96d118ca8632"
+  integrity sha512-aWDbLu1s9bmgPGXSzNCxELu+0+HQOapV/y+60gPXafR8e2g1Bifxzevaa+4L2ytCWm+CHqpELq4CSoN9ELiwCg==
   dependencies:
-    "@typescript-eslint/typescript-estree" "7.14.1"
-    "@typescript-eslint/utils" "7.14.1"
+    "@typescript-eslint/typescript-estree" "7.13.1"
+    "@typescript-eslint/utils" "7.13.1"
     debug "^4.3.4"
     ts-api-utils "^1.3.0"
 
-"@typescript-eslint/types@7.14.1":
-  version "7.14.1"
-  resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.14.1.tgz#a43a540dbe5df7f2a11269683d777fc50b4350aa"
-  integrity sha512-mL7zNEOQybo5R3AavY+Am7KLv8BorIv7HCYS5rKoNZKQD9tsfGUpO4KdAn3sSUvTiS4PQkr2+K0KJbxj8H9NDg==
+"@typescript-eslint/types@7.13.1":
+  version "7.13.1"
+  resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.13.1.tgz#787db283bd0b58751094c90d5b58bbf5e9fc9bd8"
+  integrity sha512-7K7HMcSQIAND6RBL4kDl24sG/xKM13cA85dc7JnmQXw2cBDngg7c19B++JzvJHRG3zG36n9j1i451GBzRuHchw==
 
-"@typescript-eslint/typescript-estree@7.14.1":
-  version "7.14.1"
-  resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.14.1.tgz#ba7c9bac8744487749d19569e254d057754a1575"
-  integrity sha512-k5d0VuxViE2ulIO6FbxxSZaxqDVUyMbXcidC8rHvii0I56XZPv8cq+EhMns+d/EVIL41sMXqRbK3D10Oza1bbA==
+"@typescript-eslint/typescript-estree@7.13.1":
+  version "7.13.1"
+  resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.13.1.tgz#3412841b130e070db2f675e3d9b8cb1ae49e1c3f"
+  integrity sha512-uxNr51CMV7npU1BxZzYjoVz9iyjckBduFBP0S5sLlh1tXYzHzgZ3BR9SVsNed+LmwKrmnqN3Kdl5t7eZ5TS1Yw==
   dependencies:
-    "@typescript-eslint/types" "7.14.1"
-    "@typescript-eslint/visitor-keys" "7.14.1"
+    "@typescript-eslint/types" "7.13.1"
+    "@typescript-eslint/visitor-keys" "7.13.1"
     debug "^4.3.4"
     globby "^11.1.0"
     is-glob "^4.0.3"
@@ -2146,22 +2146,22 @@
     semver "^7.6.0"
     ts-api-utils "^1.3.0"
 
-"@typescript-eslint/utils@7.14.1", "@typescript-eslint/utils@^6.0.0 || ^7.0.0":
-  version "7.14.1"
-  resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.14.1.tgz#3307b8226f99103dca2133d0ebcae38419d82c9d"
-  integrity sha512-CMmVVELns3nak3cpJhZosDkm63n+DwBlDX8g0k4QUa9BMnF+lH2lr3d130M1Zt1xxmB3LLk3NV7KQCq86ZBBhQ==
+"@typescript-eslint/utils@7.13.1", "@typescript-eslint/utils@^6.0.0 || ^7.0.0":
+  version "7.13.1"
+  resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.13.1.tgz#611083379caa0d3a2c09d126c65065a3e4337ba2"
+  integrity sha512-h5MzFBD5a/Gh/fvNdp9pTfqJAbuQC4sCN2WzuXme71lqFJsZtLbjxfSk4r3p02WIArOF9N94pdsLiGutpDbrXQ==
   dependencies:
     "@eslint-community/eslint-utils" "^4.4.0"
-    "@typescript-eslint/scope-manager" "7.14.1"
-    "@typescript-eslint/types" "7.14.1"
-    "@typescript-eslint/typescript-estree" "7.14.1"
+    "@typescript-eslint/scope-manager" "7.13.1"
+    "@typescript-eslint/types" "7.13.1"
+    "@typescript-eslint/typescript-estree" "7.13.1"
 
-"@typescript-eslint/visitor-keys@7.14.1":
-  version "7.14.1"
-  resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-7.14.1.tgz#cc79b5ea154aea734b2a13b983670749f5742274"
-  integrity sha512-Crb+F75U1JAEtBeQGxSKwI60hZmmzaqA3z9sYsVm8X7W5cwLEm5bRe0/uXS6+MR/y8CVpKSR/ontIAIEPFcEkA==
+"@typescript-eslint/visitor-keys@7.13.1":
+  version "7.13.1"
+  resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-7.13.1.tgz#9c229a795a919db61f2d7f2337ef584ac05fbe96"
+  integrity sha512-k/Bfne7lrP7hcb7m9zSsgcBmo+8eicqqfNAJ7uUY+jkTFpKeH2FSkWpFRtimBxgkyvqfu9jTPRbYOvud6isdXA==
   dependencies:
-    "@typescript-eslint/types" "7.14.1"
+    "@typescript-eslint/types" "7.13.1"
     eslint-visitor-keys "^3.4.3"
 
 "@ungap/structured-clone@^1.2.0":
@@ -2428,15 +2428,15 @@ array.prototype.toreversed@^1.1.2:
     es-abstract "^1.22.1"
     es-shim-unscopables "^1.0.0"
 
-array.prototype.tosorted@^1.1.4:
-  version "1.1.4"
-  resolved "https://registry.yarnpkg.com/array.prototype.tosorted/-/array.prototype.tosorted-1.1.4.tgz#fe954678ff53034e717ea3352a03f0b0b86f7ffc"
-  integrity sha512-p6Fx8B7b7ZhL/gmUsAy0D15WhvDccw3mnGNbZpi3pmeJdxtWsj2jEaI4Y6oo3XiHfzuSgPwKc04MYt6KgvC/wA==
+array.prototype.tosorted@^1.1.3:
+  version "1.1.3"
+  resolved "https://registry.yarnpkg.com/array.prototype.tosorted/-/array.prototype.tosorted-1.1.3.tgz#c8c89348337e51b8a3c48a9227f9ce93ceedcba8"
+  integrity sha512-/DdH4TiTmOKzyQbp/eadcCVexiCb36xJg7HshYOYJnNZFDj33GEv0P7GxsynpShhq4OLYJzbGcBDkLsDt7MnNg==
   dependencies:
-    call-bind "^1.0.7"
+    call-bind "^1.0.5"
     define-properties "^1.2.1"
-    es-abstract "^1.23.3"
-    es-errors "^1.3.0"
+    es-abstract "^1.22.3"
+    es-errors "^1.1.0"
     es-shim-unscopables "^1.0.2"
 
 arraybuffer.prototype.slice@^1.0.2:
@@ -3486,7 +3486,7 @@ es-define-property@^1.0.0:
   dependencies:
     get-intrinsic "^1.2.4"
 
-es-errors@^1.0.0, es-errors@^1.2.1, es-errors@^1.3.0:
+es-errors@^1.0.0, es-errors@^1.1.0, es-errors@^1.2.1, es-errors@^1.3.0:
   version "1.3.0"
   resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f"
   integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==
@@ -3647,15 +3647,15 @@ eslint-plugin-react-hooks@^4.6.2:
   integrity sha512-QzliNJq4GinDBcD8gPB5v0wh6g8q3SUi6EFF0x8N/BL9PoVs0atuGc47ozMRyOWAKdwaZ5OnbOEa3WR+dSGKuQ==
 
 eslint-plugin-react@^7.34.1:
-  version "7.34.3"
-  resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.34.3.tgz#9965f27bd1250a787b5d4cfcc765e5a5d58dcb7b"
-  integrity sha512-aoW4MV891jkUulwDApQbPYTVZmeuSyFrudpbTAQuj5Fv8VL+o6df2xIGpw8B0hPjAaih1/Fb0om9grCdyFYemA==
+  version "7.34.2"
+  resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.34.2.tgz#2780a1a35a51aca379d86d29b9a72adc6bfe6b66"
+  integrity sha512-2HCmrU+/JNigDN6tg55cRDKCQWicYAPB38JGSFDQt95jDm8rrvSUo7YPkOIm5l6ts1j1zCvysNcasvfTMQzUOw==
   dependencies:
     array-includes "^3.1.8"
     array.prototype.findlast "^1.2.5"
     array.prototype.flatmap "^1.3.2"
     array.prototype.toreversed "^1.1.2"
-    array.prototype.tosorted "^1.1.4"
+    array.prototype.tosorted "^1.1.3"
     doctrine "^2.1.0"
     es-iterator-helpers "^1.0.19"
     estraverse "^5.3.0"
@@ -7167,10 +7167,10 @@ stylelint-config-recommended-scss@^14.0.0:
     stylelint-config-recommended "^14.0.0"
     stylelint-scss "^6.0.0"
 
-stylelint-config-recommended@^14.0.0, stylelint-config-recommended@^14.0.1:
-  version "14.0.1"
-  resolved "https://registry.yarnpkg.com/stylelint-config-recommended/-/stylelint-config-recommended-14.0.1.tgz#d25e86409aaf79ee6c6085c2c14b33c7e23c90c6"
-  integrity sha512-bLvc1WOz/14aPImu/cufKAZYfXs/A/owZfSMZ4N+16WGXLoX5lOir53M6odBxvhgmgdxCVnNySJmZKx73T93cg==
+stylelint-config-recommended@^14.0.0:
+  version "14.0.0"
+  resolved "https://registry.yarnpkg.com/stylelint-config-recommended/-/stylelint-config-recommended-14.0.0.tgz#b395c7014838d2aaca1755eebd914d0bb5274994"
+  integrity sha512-jSkx290CglS8StmrLp2TxAppIajzIBZKYm3IxT89Kg6fGlxbPiTiyH9PS5YUuVAFwaJLl1ikiXX0QWjI0jmgZQ==
 
 stylelint-config-standard-scss@^13.0.0:
   version "13.1.0"
@@ -7181,16 +7181,16 @@ stylelint-config-standard-scss@^13.0.0:
     stylelint-config-standard "^36.0.0"
 
 stylelint-config-standard@^36.0.0:
-  version "36.0.1"
-  resolved "https://registry.yarnpkg.com/stylelint-config-standard/-/stylelint-config-standard-36.0.1.tgz#727cbb2a1ef3e210f5ce8329cde531129f156609"
-  integrity sha512-8aX8mTzJ6cuO8mmD5yon61CWuIM4UD8Q5aBcWKGSf6kg+EC3uhB+iOywpTK4ca6ZL7B49en8yanOFtUW0qNzyw==
+  version "36.0.0"
+  resolved "https://registry.yarnpkg.com/stylelint-config-standard/-/stylelint-config-standard-36.0.0.tgz#6704c044d611edc12692d4a5e37b039a441604d4"
+  integrity sha512-3Kjyq4d62bYFp/Aq8PMKDwlgUyPU4nacXsjDLWJdNPRUgpuxALu1KnlAHIj36cdtxViVhXexZij65yM0uNIHug==
   dependencies:
-    stylelint-config-recommended "^14.0.1"
+    stylelint-config-recommended "^14.0.0"
 
 stylelint-scss@^6.0.0, stylelint-scss@^6.2.1:
-  version "6.3.2"
-  resolved "https://registry.yarnpkg.com/stylelint-scss/-/stylelint-scss-6.3.2.tgz#085072e774e5a31e65aa2acefaad5417a29d6ec1"
-  integrity sha512-pNk9mXOVKkQtd+SROPC9io8ISSgX+tOVPhFdBE+LaKQnJMLdWPbGKAGYv4Wmf/RrnOjkutunNTN9kKMhkdE5qA==
+  version "6.3.1"
+  resolved "https://registry.yarnpkg.com/stylelint-scss/-/stylelint-scss-6.3.1.tgz#eb56f23f4d3e0896647365ab1681653a00bdbc2b"
+  integrity sha512-w/czBoWUZxJNk5fBRPODcXSN4qcPv3WHjTSSpFovVY+TE3MZTMR0yRlbmaDYrm8tTWHvpwQAuEBZ0lk2wwkboQ==
   dependencies:
     known-css-properties "^0.31.0"
     postcss-media-query-parser "^0.2.3"
@@ -7549,9 +7549,9 @@ typed-array-length@^1.0.6:
     possible-typed-array-names "^1.0.0"
 
 typescript@^5.4.5:
-  version "5.5.2"
-  resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.2.tgz#c26f023cb0054e657ce04f72583ea2d85f8d0507"
-  integrity sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==
+  version "5.4.5"
+  resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611"
+  integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==
 
 unbox-primitive@^1.0.2:
   version "1.0.2"


Test patch:
diff --git a/src/test/datepicker_test.test.tsx b/src/test/datepicker_test.test.tsx
index e92e4a4a..e602ad6b 100644
--- a/src/test/datepicker_test.test.tsx
+++ b/src/test/datepicker_test.test.tsx
@@ -462,10 +462,7 @@ describe("DatePicker", () => {
   });
 
   it("should update the preSelection state when a day is selected with Enter press", () => {
-    const data = getOnInputKeyDownStuff({
-      shouldCloseOnSelect: false,
-      selected: "2024-06-06",
-    });
+    const data = getOnInputKeyDownStuff({ shouldCloseOnSelect: false });
 
     fireEvent.keyDown(data.dateInput, getKey(KeyType.ArrowDown));
     const selectedDayNode = getSelectedDayNode(data.container);
@@ -1042,9 +1039,8 @@ describe("DatePicker", () => {
     expect(document.body.querySelector("#portal-id-dom-test")).not.toBeNull();
   });
 
-  // eslint-disable-next-line @typescript-eslint/no-explicit-any
-  function getOnInputKeyDownStuff(opts: { [key: string]: any } = {}) {
-    const m = newDate(opts.selected);
+  function getOnInputKeyDownStuff(opts = {}) {
+    const m = newDate();
     const copyM = newDate(m);
     const testFormat = "yyyy-MM-dd";
     const exactishFormat = "yyyy-MM-dd hh: zzzz";
diff --git a/src/test/day_test.test.tsx b/src/test/day_test.test.tsx
index 07c347a6..3fff9254 100644
--- a/src/test/day_test.test.tsx
+++ b/src/test/day_test.test.tsx
@@ -164,6 +164,17 @@ describe("Day", () => {
       ).toBe(true);
     });
 
+    it("should not apply the key-selected class when pre-selected is a part of disabled dates", () => {
+      const day = newDate();
+      const container = renderDay(day, {
+        excludeDates: [day],
+        preSelection: day,
+      });
+      const dayNode = container.querySelector(".react-datepicker__day")!;
+
+      expect(dayNode.classList.contains(className)).toBe(false);
+    });
+
     it("should not apply the keyboard-selected class when selected", () => {
       const day = newDate();
       const container = renderDay(day, { selected: day, preSelection: day });
diff --git a/src/test/month_test.test.tsx b/src/test/month_test.test.tsx
index da41acdb..9cb9dd12 100644
--- a/src/test/month_test.test.tsx
+++ b/src/test/month_test.test.tsx
@@ -924,52 +924,6 @@ describe("Month", () => {
     it("should have no axe violations", () => runAxe(monthComponent));
   });
 
-  describe("if 2 months are selected in a multi selection", () => {
-    let monthComponent: HTMLElement;
-
-    beforeEach(() => {
-      monthComponent = render(
-        <Month
-          day={newDate("2015-02-01")}
-          selectedDates={[newDate("2015-02-01"), newDate("2015-03-01")]}
-          selectsMultiple
-          showMonthYearPicker
-        />,
-      ).container;
-    });
-
-    it("should return 2 selected classes in the current year", () => {
-      expect(
-        monthComponent.querySelectorAll<HTMLElement>(
-          ".react-datepicker__month-text--selected",
-        ).length,
-      ).toBe(2);
-    });
-  });
-
-  describe("if no months are selected in a multi selection", () => {
-    let monthComponent: HTMLElement;
-
-    beforeEach(() => {
-      monthComponent = render(
-        <Month
-          day={newDate("2015-02-01")}
-          selectedDates={[]}
-          selectsMultiple
-          showMonthYearPicker
-        />,
-      ).container;
-    });
-
-    it("should return 0 selected classes in the current year", () => {
-      expect(
-        monthComponent.querySelectorAll<HTMLElement>(
-          ".react-datepicker__month-text--selected",
-        ).length,
-      ).toBe(0);
-    });
-  });
-
   describe("if month is not selected", () => {
     let month: HTMLElement;
 
@@ -2418,4 +2372,53 @@ describe("Month", () => {
       ).toBe(false);
     });
   });
+
+  describe("keyboard-selected", () => {
+    it("should not apply the keyboard-selected class when the month is a part of disabled dates", () => {
+      const keyboardSelectedDate = newDate("2024-06-03");
+      const excludeDates = [addWeeks(keyboardSelectedDate, 1)];
+
+      const { container } = render(
+        <Month
+          day={keyboardSelectedDate}
+          preSelection={keyboardSelectedDate}
+          excludeDates={excludeDates}
+          showMonthYearPicker
+        />,
+      );
+      expect(
+        container.querySelector(
+          ".react-datepicker__month-text--keyboard-selected",
+        ),
+      ).toBeNull();
+    });
+
+    it("should not apply the keyboard-selected class when the quarter is a part of disabled dates", () => {
+      const currentSelectedDate = newDate("2023-08-08");
+      const maxDate = newDate("2024-08-03");
+
+      const { container } = render(
+        <DatePicker
+          selected={currentSelectedDate}
+          maxDate={maxDate}
+          dateFormat="yyyy, QQQ"
+          showQuarterYearPicker
+        />,
+      );
+      const dateInput = container.querySelector("input")!;
+      fireEvent.focus(dateInput);
+
+      const calendar = container.querySelector(".react-datepicker")!;
+      const nextButton = calendar.querySelector(
+        ".react-datepicker__navigation--next",
+      )!;
+      fireEvent.click(nextButton);
+
+      expect(
+        container.querySelector(
+          ".react-datepicker__quarter-text--keyboard-selected",
+        ),
+      ).toBeNull();
+    });
+  });
 });
diff --git a/src/test/year_picker_test.test.tsx b/src/test/year_picker_test.test.tsx
index d7aa4cf8..a1a80264 100644
--- a/src/test/year_picker_test.test.tsx
+++ b/src/test/year_picker_test.test.tsx
@@ -603,6 +603,35 @@ describe("YearPicker", () => {
       );
       expect(allPreselectedYears.length).toBe(1);
     });
+
+    it("should not set the key-selected class when the year is a part of disabled dates", () => {
+      const date = newDate("2024-06-01");
+      const excludeDates = [newDate("2036-05-05")];
+
+      const { container } = render(
+        <DatePicker
+          selected={date}
+          excludeDates={excludeDates}
+          showYearPicker
+          dateFormat="yyyy"
+        />,
+      );
+
+      const dateInput = container.querySelector("input")!;
+      fireEvent.focus(dateInput);
+
+      const calendar = container.querySelector(".react-datepicker")!;
+      const nextButton = calendar.querySelector(
+        ".react-datepicker__navigation--next",
+      )!;
+      fireEvent.click(nextButton);
+
+      expect(
+        container.querySelector(
+          ".react-datepicker__year-text--keyboard-selected",
+        ),
+      ).toBeNull();
+    });
   });
 
   describe("Keyboard navigation", () => {