From cc4919839ca08baf341f9552d636005484afd921 Mon Sep 17 00:00:00 2001 From: Balaji Sridharan Date: Wed, 29 Nov 2023 11:01:32 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=9A:=20Rename=20getDateWithoutTime=20t?= =?UTF-8?q?o=20getMidnightDate=20for=20more=20readability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/Hacker0x01/react-datepicker/pull/4394#pullrequestreview-1753291513 --- src/index.jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/index.jsx b/src/index.jsx index 5c2b04957..648d446ed 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -68,7 +68,7 @@ function hasPreSelectionChanged(date1, date2) { return date1 !== date2; } -function getDateWithoutTime(date) { +function getMidnightDate(date) { const dateWithoutTime = new Date(date); dateWithoutTime.setHours(0, 0, 0, 0); return dateWithoutTime; @@ -599,9 +599,9 @@ export default class DatePicker extends React.Component { const { startDate, endDate } = this.props; const startDateWithoutTime = isDate(startDate) - ? getDateWithoutTime(startDate) + ? getMidnightDate(startDate) : null; - const dateWithoutTime = isDate(date) ? getDateWithoutTime(date) : null; + const dateWithoutTime = isDate(date) ? getMidnightDate(date) : null; if ( startDate && !endDate && @@ -669,8 +669,8 @@ export default class DatePicker extends React.Component { if (noRanges) { onChange([changedDate, null], event); } else if (hasStartRange) { - const startDateWithoutTime = getDateWithoutTime(startDate); - const changedDateWithoutTime = getDateWithoutTime(changedDate); + const startDateWithoutTime = getMidnightDate(startDate); + const changedDateWithoutTime = getMidnightDate(changedDate); if (isBefore(changedDateWithoutTime, startDateWithoutTime)) { onChange([changedDate, null], event);