-
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 #4170: Clear the previously selected date on empty input with showTimeSelectOnly #4336
Conversation
…electOnly Previously, the selected date was not being cleared and retained the previously selected time when an empty value was passed to the date input while showTimeSelectOnly was enabled due to a bug. This commit address the issue and adds test cases to ensure proper functionality. Closes Hacker0x01#4170
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
+ 56
- 13
72% JavaScript (tests)
28% JavaScript
Type of change
Fix - These changes are likely to be fixing a bug or issue.
Codecov Report
@@ Coverage Diff @@
## main #4336 +/- ##
==========================================
+ Coverage 96.63% 96.67% +0.03%
==========================================
Files 27 27
Lines 2375 2373 -2
Branches 953 952 -1
==========================================
- Hits 2295 2294 -1
+ Misses 80 79 -1
|
Nice refactor and fix |
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.
Overall I don't see an issue with this pull request. I note that the date !== null
case ended up executing code that should have effectively been a no-op on the date value. Though I note the biggest functional change is that setSelection is no longer called for this case.
Reviewed with ❤️ by PullRequest
Closes #4170
Summary
This PR addresses an issue where the DatePicker was not clearing the previously selected time when the user deletes the value in the date input via keyboard. This issue was only coming when the
showTimeSelectOnly
is enabled.Changes Made:
showTimeSelectOnly
using React Test Library