Repository: Hacker0x01/react-datepicker
Pull request #4808 (2024-05-22 07:12:11)

Breaking: Fix typo of the name of the function getHightLightDaysMap w…
Fixing https://github.com/Hacker0x01/react-datepicker/pull/4369 since files got converted to TS


Patch:
diff --git a/src/date_utils.ts b/src/date_utils.ts
index 9536aa0a..311f10e4 100644
--- a/src/date_utils.ts
+++ b/src/date_utils.ts
@@ -1241,7 +1241,7 @@ export interface HighlightDate {
  * @param defaultClassName The default class to use for highlighting.
  * @returns A map with dates as keys and arrays of class names as values.
  */
-export function getHightLightDaysMap(
+export function getHighLightDaysMap(
   highlightDates: (Date | HighlightDate)[] = [],
   defaultClassName: string = "react-datepicker__day--highlighted",
 ): Map<string, string[]> {
diff --git a/src/index.tsx b/src/index.tsx
index bbf0578c..d642e0cc 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -34,7 +34,7 @@ import {
   parseDate,
   safeDateFormat,
   safeDateRangeFormat,
-  getHightLightDaysMap,
+  getHighLightDaysMap,
   getYear,
   getMonth,
   getStartOfWeek,
@@ -339,7 +339,7 @@ export default class DatePicker extends Component<
     }
     if (prevProps.highlightDates !== this.props.highlightDates) {
       this.setState({
-        highlightDates: getHightLightDaysMap(this.props.highlightDates),
+        highlightDates: getHighLightDaysMap(this.props.highlightDates),
       });
     }
     if (
@@ -414,7 +414,7 @@ export default class DatePicker extends Component<
           : this.props.selected) ?? boundedPreSelection,
       // transforming highlighted days (perhaps nested array)
       // to flat Map for faster access in day.jsx
-      highlightDates: getHightLightDaysMap(this.props.highlightDates),
+      highlightDates: getHighLightDaysMap(this.props.highlightDates),
       focused: false,
       // used to focus day in inline version after month has changed, but not on
       // initial render


Test patch:
diff --git a/test/day_test.test.js b/test/day_test.test.js
index 6acdcad4..45634913 100644
--- a/test/day_test.test.js
+++ b/test/day_test.test.js
@@ -9,7 +9,7 @@ import {
   addDays,
   subDays,
   getMonth,
-  getHightLightDaysMap,
+  getHighLightDaysMap,
   getHolidaysMap,
   registerLocale,
 } from "../src/date_utils";
@@ -221,7 +221,7 @@ describe("Day", () => {
       const highlightDay1 = newDate(day);
       const highlightDay2 = addDays(day, 1);
       const highlightDates = [highlightDay1, highlightDay2];
-      const highlightDatesMap = getHightLightDaysMap(highlightDates);
+      const highlightDatesMap = getHighLightDaysMap(highlightDates);
       const container = renderDay(day, { highlightDates: highlightDatesMap });
       expect(
         container
@@ -235,7 +235,7 @@ describe("Day", () => {
       const highlightDay1 = subDays(day, 1);
       const highlightDay2 = addDays(day, 1);
       const highlightDates = [highlightDay1, highlightDay2];
-      const highlightDatesMap = getHightLightDaysMap(highlightDates);
+      const highlightDatesMap = getHighLightDaysMap(highlightDates);
       const container = renderDay(day, { highlightDates: highlightDatesMap });
       expect(
         container
@@ -253,7 +253,7 @@ describe("Day", () => {
         const highlightDay2 = addDays(day, 2);
         const highlightDay3 = addDays(day, 3);
         const highlightDates = [highlightDay1, highlightDay2, highlightDay3];
-        const highlightDatesMap = getHightLightDaysMap(highlightDates);
+        const highlightDatesMap = getHighLightDaysMap(highlightDates);
         const container = renderDay(day, {
           highlightDates: highlightDatesMap,
         });
@@ -272,7 +272,7 @@ describe("Day", () => {
         const highlightDay2 = addDays(day, 3);
         const highlightDay3 = addDays(day, 4);
         const highlightDates = [highlightDay1, highlightDay2, highlightDay3];
-        const highlightDatesMap = getHightLightDaysMap(highlightDates);
+        const highlightDatesMap = getHighLightDaysMap(highlightDates);
         const container = renderDay(day, {
           highlightDates: highlightDatesMap,
         });
@@ -289,7 +289,7 @@ describe("Day", () => {
         const highlightDay2 = { barClassName: [newDate(day)] };
         const highlightDay3 = newDate(day);
         const highlightDates = [highlightDay1, highlightDay2, highlightDay3];
-        const highlightDatesMap = getHightLightDaysMap(highlightDates);
+        const highlightDatesMap = getHighLightDaysMap(highlightDates);
         const container = renderDay(day, {
           highlightDates: highlightDatesMap,
         });