Repository: Hacker0x01/react-datepicker
Pull request #4421 (2023-12-25 07:20:42)

🐛 FIX: readability-isMonthinRange


Patch:
diff --git a/src/date_utils.js b/src/date_utils.js
index bdd48674..95301b6a 100644
--- a/src/date_utils.js
+++ b/src/date_utils.js
@@ -459,7 +459,7 @@ export function isMonthDisabled(
   );
 }
 
-export function isMonthinRange(startDate, endDate, m, day) {
+export function isMonthInRange(startDate, endDate, m, day) {
   const startDateYear = getYear(startDate);
   const startDateMonth = getMonth(startDate);
   const endDateYear = getYear(endDate);
diff --git a/src/month.jsx b/src/month.jsx
index db7fd71d..c97979de 100644
--- a/src/month.jsx
+++ b/src/month.jsx
@@ -191,15 +191,15 @@ export default class Month extends React.Component {
     }
 
     if (selectsStart && endDate) {
-      return utils.isMonthinRange(selectingDate, endDate, m, day);
+      return utils.isMonthInRange(selectingDate, endDate, m, day);
     }
 
     if (selectsEnd && startDate) {
-      return utils.isMonthinRange(startDate, selectingDate, m, day);
+      return utils.isMonthInRange(startDate, selectingDate, m, day);
     }
 
     if (selectsRange && startDate && !endDate) {
-      return utils.isMonthinRange(startDate, selectingDate, m, day);
+      return utils.isMonthInRange(startDate, selectingDate, m, day);
     }
 
     return false;
@@ -532,7 +532,7 @@ export default class Month extends React.Component {
           utils.getMonth(preSelection) === m,
         "react-datepicker__month-text--in-selecting-range":
           this.isInSelectingRangeMonth(m),
-        "react-datepicker__month-text--in-range": utils.isMonthinRange(
+        "react-datepicker__month-text--in-range": utils.isMonthInRange(
           startDate,
           endDate,
           m,


Test patch:
diff --git a/test/date_utils_test.test.js b/test/date_utils_test.test.js
index e755357c..5caf854f 100644
--- a/test/date_utils_test.test.js
+++ b/test/date_utils_test.test.js
@@ -26,7 +26,7 @@ import {
   isTimeInDisabledRange,
   isDayInRange,
   parseDate,
-  isMonthinRange,
+  isMonthInRange,
   isQuarterInRange,
   isYearInRange,
   getStartOfYear,
@@ -974,13 +974,13 @@ describe("date_utils", () => {
     });
   });
 
-  describe("isMonthinRange", () => {
+  describe("isMonthInRange", () => {
     it("should return true if the month passed is in range", () => {
       const day = newDate("2015-02-01");
       const startDate = newDate("2015-01-01");
       const endDate = newDate("2015-08-01");
 
-      expect(isMonthinRange(startDate, endDate, 4, day)).toBe(true);
+      expect(isMonthInRange(startDate, endDate, 4, day)).toBe(true);
     });
 
     it("should return false if the month passed is not in range", () => {
@@ -988,7 +988,7 @@ describe("date_utils", () => {
       const startDate = newDate("2015-01-01");
       const endDate = newDate("2015-08-01");
 
-      expect(isMonthinRange(startDate, endDate, 9, day)).toBe(false);
+      expect(isMonthInRange(startDate, endDate, 9, day)).toBe(false);
     });
 
     it("should return true if the month passed is in range and maxDate +1 year", () => {
@@ -996,7 +996,7 @@ describe("date_utils", () => {
       const startDate = newDate("2019-06-04");
       const endDate = newDate("2020-02-01");
 
-      expect(isMonthinRange(startDate, endDate, 5, day)).toBe(true);
+      expect(isMonthInRange(startDate, endDate, 5, day)).toBe(true);
     });
   });