-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #4076: Trigger onCalendarClose event and onChange even when the same date is selected as the start and the end date in a date range #4394
Conversation
…selected for a date range This commit resolves the following issue 1. Previously we were checking whether to emit the onCalendarClose close or not using the isBefore function but the issue is the startDate has the default time added, but the endDate we get from the calendar component doesn't has any time added to it, hence the isBefore check was failing as the startDate with some time is always ahead of the same date (endDate) without time 2. Similarly we were using the same isBefore function to decide whether to consider the date as startDate or endDate for onChange event handler, as the isBefore will fail because of the few milli-sec difference and the onChange call will fail. As a result the end date (the currently selected date) is being considered as the startDate, hence we need to once again select the endDate value Closes: Hacker0x01#4076
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ This pull request was sent to the PullRequest network.
@balajis-qb you can click here to see the review status or cancel the code review job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PullRequest Breakdown
Reviewable lines of change
+ 194
- 3
77% JavaScript (tests)
23% JavaScript
Type of change
Fix - These changes are likely to be fixing a bug or issue.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4394 +/- ##
==========================================
+ Coverage 95.30% 95.41% +0.11%
==========================================
Files 28 29 +1
Lines 2491 2508 +17
Branches 1024 1025 +1
==========================================
+ Hits 2374 2393 +19
+ Misses 117 115 -2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return `00${dayString}`; | ||
} | ||
if (dayString.length === 2) { | ||
return `0${dayString}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this issue is properly solved by this change (read: you'd have to copy/paste this change each and every time you use the calendar). The root cause of the problem is that this.props.startDate
and this.props.endDate
come in with different conventions, with startDate
being the current Date
and endDate
being today's midnight Date
. I can't see the producer of these props, but solving for this discrepancy would avoid this logic leakage with getDateWithoutTime
which is only useful to patch this one issue (and should probably be named getMidnightDate
).
Reviewed with ❤️ by PullRequest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✖️ This code review was cancelled. See Details
Hi, |
Pullrequest team, can you give this a final review? |
As the original issue-raiser, I really want A fix being merged, but from above comment:
If that's true, even though this change might fix the issue, it feels like it's not the best way to fix it. Can we review the logic of how the defaults of endDate is set? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ This pull request was sent to the PullRequest network.
@balajis-qb you can click here to see the review status or cancel the code review job - or - cancel by adding [!pr] to the title of the pull request.
src/date_utils.js
Outdated
* It evaluates whether date is before dateToCompare based on their mid-night timestamps. | ||
*/ | ||
export function isDateBefore(date, dateToCompare) { | ||
const midnightDate = isDate(date) ? getMidnightDate(date) : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, we are returning false, which is technically correct. Throwing an exception would make it even more a better implementation I guess. I'll update the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the cod to throw an error when it receives an invalid date
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think rounding to the nearest date is maybe a little too blunt and unnecessary but I might not be understanding how you're using this. It seems like you should be able to rely on date-fns
more than you are.
Reviewed with ❤️ by PullRequest
? getMidnightDate(dateToCompare) | ||
: null; | ||
|
||
return isBefore(midnightDate, midnightDateToCompare); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so i'm guessing this returns either -1, 0 or 1 like the datefns
functions compareAsc
etc? I am not familiar with your implementation of isBefore
it seems from your PR description that the issue is just that sometimes a difference of a few milliseconds causes the events to fire incorrectly. It seems like rounding to the nearest day is a rather blunt instrument for such a small difference.
🔸 Bug (Important)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Andy,
Thank you for your comment. I'll quickly describe the issue, the calender is not automatically getting closed when the startDate
and the endDate
of the date range are same, the dates are getting selected, but users need to click outside to close the calendar. This issue will only come when there is a default value for the startDate with time, means we have some time attached to the startDate, but the dates emitted from the calendar component don't have time. That was the issue.
Suppose if there is no default date set for the startDate or there is a default date with no time, in that case the existing code will work, because we don't need to append any time at the later part of the time, so it'll work.
But the issue comes when we have a default startDate with time (in the specified example in the issue, as it's Date.now() will give current date with time), because to decide whether we need to close the calendar or not, we'll be checking whether the selected endDate occurs before the startDate. Here as the startDate has the time which is passed to it from the props, the startDate looks greater than the endDate, and the close operation will be skipped. But for the calendar close operation, why we need to care about the time, because there the language is only in date and not in time. Hence I added a new helper called isDateBefore. We already have a helper from the date-fns called isBefore, isBefore will check whether one date is before another date, it also includes time in its comparision. But in our case, we just need to take the date part of it, to check whether a selected date is before or after the currently selected endDate. So, I create this new helper called isDateBefore, which will round the time part of the dates to the mindNight time and compare, so here the date will be retained, but just the time will be rounded which will help us for our comparision.
Hello Everyone, Thank you everyone for your review of my fix. By checking all the reviews, I think I didn't add the proper description to justify my change. Most of the reviewers asked regarding the new helper isDateBefore. I'll once again explain the issue and the fix I made. What is the reported issue?@guanpu reported that the When the issue won't occur?Even if the reporter @guanpu mentioned the
If you check the above code, I didn't set any default value for the startDate (& also the endDate). In this case, the issue won't occur. There is one another case
In the above case, the issue won't occur as the defaultStartDate don't have time. When the issue occurs?So, the issue occurs only in the case where we set some startDate and that also has some time attached to it like the example mentioned by @guanpu in the issue or like below
What causes the issue?Whenever we select any date from the calendar component, obviously the calendar component won't attach any time value to it. So, it'll be in the format like Whenever we select a date, at first the Later the setSelected method will get called, which will preserve the time value we set from the default startDate or endDate to the corresponding selected start/end date. There are 2 cases now
What is my solution?I solved this issue in the following way. The language of the calendar will be in the day format and not in the time format. The date we received from the calendar component on Here we solved the issue by setting the same time value for both the dates that we wish to compare (which is 00), but, however, we instead of 00, we can set any constant time value to the dates to make the fix works, because if the time value is same, only difference would is of date. Hope my explanation answered all your questions. If you have a question like, then do we need to replace all |
… the received dates are invalid Instead of returning false, throw an exception
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [react-datepicker](https://togithub.com/Hacker0x01/react-datepicker) | [`^4.20.0` -> `^5.0.0`](https://renovatebot.com/diffs/npm/react-datepicker/4.23.0/5.1.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/react-datepicker/5.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-datepicker/5.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-datepicker/4.23.0/5.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-datepicker/4.23.0/5.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>Hacker0x01/react-datepicker (react-datepicker)</summary> ### [`v5.1.0`](https://togithub.com/Hacker0x01/react-datepicker/compare/v5.0.0...v5.1.0) [Compare Source](https://togithub.com/Hacker0x01/react-datepicker/compare/v5.0.0...v5.1.0) ### [`v5.0.0`](https://togithub.com/Hacker0x01/react-datepicker/releases/tag/v5.0.0): 5.0.0 [Compare Source](https://togithub.com/Hacker0x01/react-datepicker/compare/v4.25.0...v5.0.0) #### Breaking changes - Migrate from Popper.js to Floating-UI by [@​G07cha](https://togithub.com/G07cha) in [Hacker0x01/react-datepicker#4393 #### What's Changed - 🐛 FIX: readability-isMonthinRange by [@​mary139](https://togithub.com/mary139) in [Hacker0x01/react-datepicker#4421 - Fix [#​4431](https://togithub.com/Hacker0x01/react-datepicker/issues/4431): Update the excludedDate to match the year to check of the isYearDisabled by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4432 - Fix [#​4420](https://togithub.com/Hacker0x01/react-datepicker/issues/4420): Update home key and end key navigation in Calendar component by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4430 - Document [#​4420](https://togithub.com/Hacker0x01/react-datepicker/issues/4420): 📝 Update the behavior of Home Key and End Key in the README file by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4438 - Fix [#​4076](https://togithub.com/Hacker0x01/react-datepicker/issues/4076): Trigger onCalendarClose event and onChange even when the same date is selected as the start and the end date in a date range by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4394 - Excluded dates message by [@​dvelazquez1282](https://togithub.com/dvelazquez1282) in [Hacker0x01/react-datepicker#4437 - Fix [#​4456](https://togithub.com/Hacker0x01/react-datepicker/issues/4456): Add shift+pageUp key and shift+pageDown key navigation in Calendar component by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4457 - Fix options passed to date-fns/format by [@​emilecantin](https://togithub.com/emilecantin) in [Hacker0x01/react-datepicker#4469 #### New Contributors - [@​mary139](https://togithub.com/mary139) made their first contribution in [Hacker0x01/react-datepicker#4421 - [@​G07cha](https://togithub.com/G07cha) made their first contribution in [Hacker0x01/react-datepicker#4393 - [@​dvelazquez1282](https://togithub.com/dvelazquez1282) made their first contribution in [Hacker0x01/react-datepicker#4437 - [@​emilecantin](https://togithub.com/emilecantin) made their first contribution in [Hacker0x01/react-datepicker#4469 **Full Changelog**: Hacker0x01/react-datepicker@v4.25.0...v5.0.0 ### [`v4.25.0`](https://togithub.com/Hacker0x01/react-datepicker/releases/tag/v4.25.0): 4.25.0 [Compare Source](https://togithub.com/Hacker0x01/react-datepicker/compare/v4.24.0...v4.25.0) #### What's Changed - feature: Add day parameter to renderMonthContent function by [@​omarhoumz](https://togithub.com/omarhoumz) in [Hacker0x01/react-datepicker#4405 - Update 'Local Development' instruction of README.md by [@​raceStarter](https://togithub.com/raceStarter) in [Hacker0x01/react-datepicker#4391 - Feature [#​4091](https://togithub.com/Hacker0x01/react-datepicker/issues/4091) - Make the Calendar Icon clickable by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4417 #### New Contributors - [@​omarhoumz](https://togithub.com/omarhoumz) made their first contribution in [Hacker0x01/react-datepicker#4405 - [@​raceStarter](https://togithub.com/raceStarter) made their first contribution in [Hacker0x01/react-datepicker#4391 **Full Changelog**: Hacker0x01/react-datepicker@v4.24.0...v4.25.0 ### [`v4.24.0`](https://togithub.com/Hacker0x01/react-datepicker/releases/tag/v4.24.0): 4.24.0 [Compare Source](https://togithub.com/Hacker0x01/react-datepicker/compare/v4.23.0...v4.24.0) #### What's Changed - containerRef div shouldnt affect styling by [@​joaopaulo-capy](https://togithub.com/joaopaulo-capy) in [Hacker0x01/react-datepicker#4384 - Fix: reflect the `holidays` prop change by [@​shimech](https://togithub.com/shimech) in [Hacker0x01/react-datepicker#4373 - Disable clear button when the component is disabled by [@​Rafatcb](https://togithub.com/Rafatcb) in [Hacker0x01/react-datepicker#4392 #### New Contributors - [@​joaopaulo-capy](https://togithub.com/joaopaulo-capy) made their first contribution in [Hacker0x01/react-datepicker#4384 - [@​shimech](https://togithub.com/shimech) made their first contribution in [Hacker0x01/react-datepicker#4373 - [@​Rafatcb](https://togithub.com/Rafatcb) made their first contribution in [Hacker0x01/react-datepicker#4392 **Full Changelog**: Hacker0x01/react-datepicker@v4.23.0...v4.24.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMzUuMCIsInVwZGF0ZWRJblZlciI6IjM3LjE1My4yIiwidGFyZ2V0QnJhbmNoIjoiY2FuYXJ5In0=-->
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [react-datepicker](https://togithub.com/Hacker0x01/react-datepicker) | [`^4.20.0` -> `^5.0.0`](https://renovatebot.com/diffs/npm/react-datepicker/4.23.0/5.1.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/react-datepicker/5.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-datepicker/5.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-datepicker/4.23.0/5.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-datepicker/4.23.0/5.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>Hacker0x01/react-datepicker (react-datepicker)</summary> ### [`v5.1.0`](https://togithub.com/Hacker0x01/react-datepicker/compare/v5.0.0...v5.1.0) [Compare Source](https://togithub.com/Hacker0x01/react-datepicker/compare/v5.0.0...v5.1.0) ### [`v5.0.0`](https://togithub.com/Hacker0x01/react-datepicker/releases/tag/v5.0.0): 5.0.0 [Compare Source](https://togithub.com/Hacker0x01/react-datepicker/compare/v4.25.0...v5.0.0) #### Breaking changes - Migrate from Popper.js to Floating-UI by [@​G07cha](https://togithub.com/G07cha) in [Hacker0x01/react-datepicker#4393 #### What's Changed - 🐛 FIX: readability-isMonthinRange by [@​mary139](https://togithub.com/mary139) in [Hacker0x01/react-datepicker#4421 - Fix [#​4431](https://togithub.com/Hacker0x01/react-datepicker/issues/4431): Update the excludedDate to match the year to check of the isYearDisabled by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4432 - Fix [#​4420](https://togithub.com/Hacker0x01/react-datepicker/issues/4420): Update home key and end key navigation in Calendar component by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4430 - Document [#​4420](https://togithub.com/Hacker0x01/react-datepicker/issues/4420): 📝 Update the behavior of Home Key and End Key in the README file by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4438 - Fix [#​4076](https://togithub.com/Hacker0x01/react-datepicker/issues/4076): Trigger onCalendarClose event and onChange even when the same date is selected as the start and the end date in a date range by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4394 - Excluded dates message by [@​dvelazquez1282](https://togithub.com/dvelazquez1282) in [Hacker0x01/react-datepicker#4437 - Fix [#​4456](https://togithub.com/Hacker0x01/react-datepicker/issues/4456): Add shift+pageUp key and shift+pageDown key navigation in Calendar component by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4457 - Fix options passed to date-fns/format by [@​emilecantin](https://togithub.com/emilecantin) in [Hacker0x01/react-datepicker#4469 #### New Contributors - [@​mary139](https://togithub.com/mary139) made their first contribution in [Hacker0x01/react-datepicker#4421 - [@​G07cha](https://togithub.com/G07cha) made their first contribution in [Hacker0x01/react-datepicker#4393 - [@​dvelazquez1282](https://togithub.com/dvelazquez1282) made their first contribution in [Hacker0x01/react-datepicker#4437 - [@​emilecantin](https://togithub.com/emilecantin) made their first contribution in [Hacker0x01/react-datepicker#4469 **Full Changelog**: Hacker0x01/react-datepicker@v4.25.0...v5.0.0 ### [`v4.25.0`](https://togithub.com/Hacker0x01/react-datepicker/releases/tag/v4.25.0): 4.25.0 [Compare Source](https://togithub.com/Hacker0x01/react-datepicker/compare/v4.24.0...v4.25.0) #### What's Changed - feature: Add day parameter to renderMonthContent function by [@​omarhoumz](https://togithub.com/omarhoumz) in [Hacker0x01/react-datepicker#4405 - Update 'Local Development' instruction of README.md by [@​raceStarter](https://togithub.com/raceStarter) in [Hacker0x01/react-datepicker#4391 - Feature [#​4091](https://togithub.com/Hacker0x01/react-datepicker/issues/4091) - Make the Calendar Icon clickable by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4417 #### New Contributors - [@​omarhoumz](https://togithub.com/omarhoumz) made their first contribution in [Hacker0x01/react-datepicker#4405 - [@​raceStarter](https://togithub.com/raceStarter) made their first contribution in [Hacker0x01/react-datepicker#4391 **Full Changelog**: Hacker0x01/react-datepicker@v4.24.0...v4.25.0 ### [`v4.24.0`](https://togithub.com/Hacker0x01/react-datepicker/releases/tag/v4.24.0): 4.24.0 [Compare Source](https://togithub.com/Hacker0x01/react-datepicker/compare/v4.23.0...v4.24.0) #### What's Changed - containerRef div shouldnt affect styling by [@​joaopaulo-capy](https://togithub.com/joaopaulo-capy) in [Hacker0x01/react-datepicker#4384 - Fix: reflect the `holidays` prop change by [@​shimech](https://togithub.com/shimech) in [Hacker0x01/react-datepicker#4373 - Disable clear button when the component is disabled by [@​Rafatcb](https://togithub.com/Rafatcb) in [Hacker0x01/react-datepicker#4392 #### New Contributors - [@​joaopaulo-capy](https://togithub.com/joaopaulo-capy) made their first contribution in [Hacker0x01/react-datepicker#4384 - [@​shimech](https://togithub.com/shimech) made their first contribution in [Hacker0x01/react-datepicker#4373 - [@​Rafatcb](https://togithub.com/Rafatcb) made their first contribution in [Hacker0x01/react-datepicker#4392 **Full Changelog**: Hacker0x01/react-datepicker@v4.23.0...v4.24.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMzUuMCIsInVwZGF0ZWRJblZlciI6IjM3LjE1My4yIiwidGFyZ2V0QnJhbmNoIjoiY2FuYXJ5In0=-->
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [react-datepicker](https://togithub.com/Hacker0x01/react-datepicker) | [`^4.20.0` -> `^5.0.0`](https://renovatebot.com/diffs/npm/react-datepicker/4.23.0/5.1.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/react-datepicker/5.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-datepicker/5.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-datepicker/4.23.0/5.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-datepicker/4.23.0/5.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>Hacker0x01/react-datepicker (react-datepicker)</summary> ### [`v5.1.0`](https://togithub.com/Hacker0x01/react-datepicker/compare/v5.0.0...v5.1.0) [Compare Source](https://togithub.com/Hacker0x01/react-datepicker/compare/v5.0.0...v5.1.0) ### [`v5.0.0`](https://togithub.com/Hacker0x01/react-datepicker/releases/tag/v5.0.0): 5.0.0 [Compare Source](https://togithub.com/Hacker0x01/react-datepicker/compare/v4.25.0...v5.0.0) #### Breaking changes - Migrate from Popper.js to Floating-UI by [@​G07cha](https://togithub.com/G07cha) in [Hacker0x01/react-datepicker#4393 #### What's Changed - 🐛 FIX: readability-isMonthinRange by [@​mary139](https://togithub.com/mary139) in [Hacker0x01/react-datepicker#4421 - Fix [#​4431](https://togithub.com/Hacker0x01/react-datepicker/issues/4431): Update the excludedDate to match the year to check of the isYearDisabled by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4432 - Fix [#​4420](https://togithub.com/Hacker0x01/react-datepicker/issues/4420): Update home key and end key navigation in Calendar component by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4430 - Document [#​4420](https://togithub.com/Hacker0x01/react-datepicker/issues/4420): 📝 Update the behavior of Home Key and End Key in the README file by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4438 - Fix [#​4076](https://togithub.com/Hacker0x01/react-datepicker/issues/4076): Trigger onCalendarClose event and onChange even when the same date is selected as the start and the end date in a date range by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4394 - Excluded dates message by [@​dvelazquez1282](https://togithub.com/dvelazquez1282) in [Hacker0x01/react-datepicker#4437 - Fix [#​4456](https://togithub.com/Hacker0x01/react-datepicker/issues/4456): Add shift+pageUp key and shift+pageDown key navigation in Calendar component by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4457 - Fix options passed to date-fns/format by [@​emilecantin](https://togithub.com/emilecantin) in [Hacker0x01/react-datepicker#4469 #### New Contributors - [@​mary139](https://togithub.com/mary139) made their first contribution in [Hacker0x01/react-datepicker#4421 - [@​G07cha](https://togithub.com/G07cha) made their first contribution in [Hacker0x01/react-datepicker#4393 - [@​dvelazquez1282](https://togithub.com/dvelazquez1282) made their first contribution in [Hacker0x01/react-datepicker#4437 - [@​emilecantin](https://togithub.com/emilecantin) made their first contribution in [Hacker0x01/react-datepicker#4469 **Full Changelog**: Hacker0x01/react-datepicker@v4.25.0...v5.0.0 ### [`v4.25.0`](https://togithub.com/Hacker0x01/react-datepicker/releases/tag/v4.25.0): 4.25.0 [Compare Source](https://togithub.com/Hacker0x01/react-datepicker/compare/v4.24.0...v4.25.0) #### What's Changed - feature: Add day parameter to renderMonthContent function by [@​omarhoumz](https://togithub.com/omarhoumz) in [Hacker0x01/react-datepicker#4405 - Update 'Local Development' instruction of README.md by [@​raceStarter](https://togithub.com/raceStarter) in [Hacker0x01/react-datepicker#4391 - Feature [#​4091](https://togithub.com/Hacker0x01/react-datepicker/issues/4091) - Make the Calendar Icon clickable by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4417 #### New Contributors - [@​omarhoumz](https://togithub.com/omarhoumz) made their first contribution in [Hacker0x01/react-datepicker#4405 - [@​raceStarter](https://togithub.com/raceStarter) made their first contribution in [Hacker0x01/react-datepicker#4391 **Full Changelog**: Hacker0x01/react-datepicker@v4.24.0...v4.25.0 ### [`v4.24.0`](https://togithub.com/Hacker0x01/react-datepicker/releases/tag/v4.24.0): 4.24.0 [Compare Source](https://togithub.com/Hacker0x01/react-datepicker/compare/v4.23.0...v4.24.0) #### What's Changed - containerRef div shouldnt affect styling by [@​joaopaulo-capy](https://togithub.com/joaopaulo-capy) in [Hacker0x01/react-datepicker#4384 - Fix: reflect the `holidays` prop change by [@​shimech](https://togithub.com/shimech) in [Hacker0x01/react-datepicker#4373 - Disable clear button when the component is disabled by [@​Rafatcb](https://togithub.com/Rafatcb) in [Hacker0x01/react-datepicker#4392 #### New Contributors - [@​joaopaulo-capy](https://togithub.com/joaopaulo-capy) made their first contribution in [Hacker0x01/react-datepicker#4384 - [@​shimech](https://togithub.com/shimech) made their first contribution in [Hacker0x01/react-datepicker#4373 - [@​Rafatcb](https://togithub.com/Rafatcb) made their first contribution in [Hacker0x01/react-datepicker#4392 **Full Changelog**: Hacker0x01/react-datepicker@v4.23.0...v4.24.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMzUuMCIsInVwZGF0ZWRJblZlciI6IjM3LjE1My4yIiwidGFyZ2V0QnJhbmNoIjoiY2FuYXJ5In0=-->
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [react-datepicker](https://togithub.com/Hacker0x01/react-datepicker) | [`^4.20.0` -> `^5.0.0`](https://renovatebot.com/diffs/npm/react-datepicker/4.23.0/5.1.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/react-datepicker/5.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-datepicker/5.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-datepicker/4.23.0/5.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-datepicker/4.23.0/5.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>Hacker0x01/react-datepicker (react-datepicker)</summary> ### [`v5.1.0`](https://togithub.com/Hacker0x01/react-datepicker/compare/v5.0.0...v5.1.0) [Compare Source](https://togithub.com/Hacker0x01/react-datepicker/compare/v5.0.0...v5.1.0) ### [`v5.0.0`](https://togithub.com/Hacker0x01/react-datepicker/releases/tag/v5.0.0): 5.0.0 [Compare Source](https://togithub.com/Hacker0x01/react-datepicker/compare/v4.25.0...v5.0.0) #### Breaking changes - Migrate from Popper.js to Floating-UI by [@​G07cha](https://togithub.com/G07cha) in [Hacker0x01/react-datepicker#4393 #### What's Changed - 🐛 FIX: readability-isMonthinRange by [@​mary139](https://togithub.com/mary139) in [Hacker0x01/react-datepicker#4421 - Fix [#​4431](https://togithub.com/Hacker0x01/react-datepicker/issues/4431): Update the excludedDate to match the year to check of the isYearDisabled by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4432 - Fix [#​4420](https://togithub.com/Hacker0x01/react-datepicker/issues/4420): Update home key and end key navigation in Calendar component by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4430 - Document [#​4420](https://togithub.com/Hacker0x01/react-datepicker/issues/4420): 📝 Update the behavior of Home Key and End Key in the README file by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4438 - Fix [#​4076](https://togithub.com/Hacker0x01/react-datepicker/issues/4076): Trigger onCalendarClose event and onChange even when the same date is selected as the start and the end date in a date range by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4394 - Excluded dates message by [@​dvelazquez1282](https://togithub.com/dvelazquez1282) in [Hacker0x01/react-datepicker#4437 - Fix [#​4456](https://togithub.com/Hacker0x01/react-datepicker/issues/4456): Add shift+pageUp key and shift+pageDown key navigation in Calendar component by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4457 - Fix options passed to date-fns/format by [@​emilecantin](https://togithub.com/emilecantin) in [Hacker0x01/react-datepicker#4469 #### New Contributors - [@​mary139](https://togithub.com/mary139) made their first contribution in [Hacker0x01/react-datepicker#4421 - [@​G07cha](https://togithub.com/G07cha) made their first contribution in [Hacker0x01/react-datepicker#4393 - [@​dvelazquez1282](https://togithub.com/dvelazquez1282) made their first contribution in [Hacker0x01/react-datepicker#4437 - [@​emilecantin](https://togithub.com/emilecantin) made their first contribution in [Hacker0x01/react-datepicker#4469 **Full Changelog**: Hacker0x01/react-datepicker@v4.25.0...v5.0.0 ### [`v4.25.0`](https://togithub.com/Hacker0x01/react-datepicker/releases/tag/v4.25.0): 4.25.0 [Compare Source](https://togithub.com/Hacker0x01/react-datepicker/compare/v4.24.0...v4.25.0) #### What's Changed - feature: Add day parameter to renderMonthContent function by [@​omarhoumz](https://togithub.com/omarhoumz) in [Hacker0x01/react-datepicker#4405 - Update 'Local Development' instruction of README.md by [@​raceStarter](https://togithub.com/raceStarter) in [Hacker0x01/react-datepicker#4391 - Feature [#​4091](https://togithub.com/Hacker0x01/react-datepicker/issues/4091) - Make the Calendar Icon clickable by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4417 #### New Contributors - [@​omarhoumz](https://togithub.com/omarhoumz) made their first contribution in [Hacker0x01/react-datepicker#4405 - [@​raceStarter](https://togithub.com/raceStarter) made their first contribution in [Hacker0x01/react-datepicker#4391 **Full Changelog**: Hacker0x01/react-datepicker@v4.24.0...v4.25.0 ### [`v4.24.0`](https://togithub.com/Hacker0x01/react-datepicker/releases/tag/v4.24.0): 4.24.0 [Compare Source](https://togithub.com/Hacker0x01/react-datepicker/compare/v4.23.0...v4.24.0) #### What's Changed - containerRef div shouldnt affect styling by [@​joaopaulo-capy](https://togithub.com/joaopaulo-capy) in [Hacker0x01/react-datepicker#4384 - Fix: reflect the `holidays` prop change by [@​shimech](https://togithub.com/shimech) in [Hacker0x01/react-datepicker#4373 - Disable clear button when the component is disabled by [@​Rafatcb](https://togithub.com/Rafatcb) in [Hacker0x01/react-datepicker#4392 #### New Contributors - [@​joaopaulo-capy](https://togithub.com/joaopaulo-capy) made their first contribution in [Hacker0x01/react-datepicker#4384 - [@​shimech](https://togithub.com/shimech) made their first contribution in [Hacker0x01/react-datepicker#4373 - [@​Rafatcb](https://togithub.com/Rafatcb) made their first contribution in [Hacker0x01/react-datepicker#4392 **Full Changelog**: Hacker0x01/react-datepicker@v4.23.0...v4.24.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/toeverything/AFFiNE). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMzUuMCIsInVwZGF0ZWRJblZlciI6IjM3LjE1My4yIiwidGFyZ2V0QnJhbmNoIjoiY2FuYXJ5In0=-->
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [react-datepicker](https://togithub.com/Hacker0x01/react-datepicker) | [`^4.14.0` -> `^6.0.0`](https://renovatebot.com/diffs/npm/react-datepicker/4.25.0/6.1.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/react-datepicker/6.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-datepicker/6.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-datepicker/4.25.0/6.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-datepicker/4.25.0/6.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [@types/react-datepicker](https://togithub.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-datepicker) ([source](https://togithub.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-datepicker)) | [`^4.11.2` -> `^6.0.0`](https://renovatebot.com/diffs/npm/@types%2freact-datepicker/4.19.6/6.0.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@types%2freact-datepicker/6.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@types%2freact-datepicker/6.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@types%2freact-datepicker/4.19.6/6.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@types%2freact-datepicker/4.19.6/6.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>Hacker0x01/react-datepicker (react-datepicker)</summary> ### [`v6.1.0`](https://togithub.com/Hacker0x01/react-datepicker/releases/tag/v6.1.0): 6.1.0 [Compare Source](https://togithub.com/Hacker0x01/react-datepicker/compare/v6.0.0...v6.1.0) #### What's Changed - Fix - Removed defaultProps from Function Components for React 18.3. by [@​shyk001](https://togithub.com/shyk001) in [Hacker0x01/react-datepicker#4498 #### New Contributors - [@​shyk001](https://togithub.com/shyk001) made their first contribution in [Hacker0x01/react-datepicker#4498 **Full Changelog**: Hacker0x01/react-datepicker@v6.0.0...v6.1.0 ### [`v6.0.0`](https://togithub.com/Hacker0x01/react-datepicker/releases/tag/v6.0.0): 6.0.0 [Compare Source](https://togithub.com/Hacker0x01/react-datepicker/compare/v5.1.0...v6.0.0) #### What's Changed - Upgrade date-fns to v3 by [@​ethanve](https://togithub.com/ethanve) in [Hacker0x01/react-datepicker#4481 - Switch workflows to Node 20 by [@​martijnrusschen](https://togithub.com/martijnrusschen) in [Hacker0x01/react-datepicker#4490 #### New Contributors - [@​ethanve](https://togithub.com/ethanve) made their first contribution in [Hacker0x01/react-datepicker#4481 **Full Changelog**: Hacker0x01/react-datepicker@v5.1.0...v6.0.0 ### [`v5.1.0`](https://togithub.com/Hacker0x01/react-datepicker/releases/tag/v5.1.0): 5.1.0 [Compare Source](https://togithub.com/Hacker0x01/react-datepicker/compare/v5.0.0...v5.1.0) #### What's Changed - Fix options passed to date-fns/parse by [@​emilecantin](https://togithub.com/emilecantin) in [Hacker0x01/react-datepicker#4474 **Full Changelog**: Hacker0x01/react-datepicker@v5.0.0...v5.1.0 ### [`v5.0.0`](https://togithub.com/Hacker0x01/react-datepicker/releases/tag/v5.0.0): 5.0.0 [Compare Source](https://togithub.com/Hacker0x01/react-datepicker/compare/v4.25.0...v5.0.0) #### Breaking changes - Migrate from Popper.js to Floating-UI by [@​G07cha](https://togithub.com/G07cha) in [Hacker0x01/react-datepicker#4393 #### What's Changed - 🐛 FIX: readability-isMonthinRange by [@​mary139](https://togithub.com/mary139) in [Hacker0x01/react-datepicker#4421 - Fix [#​4431](https://togithub.com/Hacker0x01/react-datepicker/issues/4431): Update the excludedDate to match the year to check of the isYearDisabled by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4432 - Fix [#​4420](https://togithub.com/Hacker0x01/react-datepicker/issues/4420): Update home key and end key navigation in Calendar component by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4430 - Document [#​4420](https://togithub.com/Hacker0x01/react-datepicker/issues/4420): 📝 Update the behavior of Home Key and End Key in the README file by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4438 - Fix [#​4076](https://togithub.com/Hacker0x01/react-datepicker/issues/4076): Trigger onCalendarClose event and onChange even when the same date is selected as the start and the end date in a date range by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4394 - Excluded dates message by [@​dvelazquez1282](https://togithub.com/dvelazquez1282) in [Hacker0x01/react-datepicker#4437 - Fix [#​4456](https://togithub.com/Hacker0x01/react-datepicker/issues/4456): Add shift+pageUp key and shift+pageDown key navigation in Calendar component by [@​balajis-qb](https://togithub.com/balajis-qb) in [Hacker0x01/react-datepicker#4457 - Fix options passed to date-fns/format by [@​emilecantin](https://togithub.com/emilecantin) in [Hacker0x01/react-datepicker#4469 #### New Contributors - [@​mary139](https://togithub.com/mary139) made their first contribution in [Hacker0x01/react-datepicker#4421 - [@​G07cha](https://togithub.com/G07cha) made their first contribution in [Hacker0x01/react-datepicker#4393 - [@​dvelazquez1282](https://togithub.com/dvelazquez1282) made their first contribution in [Hacker0x01/react-datepicker#4437 - [@​emilecantin](https://togithub.com/emilecantin) made their first contribution in [Hacker0x01/react-datepicker#4469 **Full Changelog**: Hacker0x01/react-datepicker@v4.25.0...v5.0.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/ASVGay/the-rhapsodies). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNzMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjE3My4wIiwidGFyZ2V0QnJhbmNoIjoiZGV2In0=-->
Closes: #4076
This ticket fixes the following issues
isBefore
check was failing as the startDate with some time is always ahead of the same date (endDate) without time2. Similarly we were using the same isBefore function to decide whether to consider the date as startDate or endDate for
onChange
event handler, as the isBefore will fail because of the few milli-sec difference and the onChange call will fail. As a result, the end date (the currently selected date) is being considered as the startDate, hence we need to once again select the endDate valueI fixed the above issues by only comparing the date and not considering the time.