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.
✅ 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.
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.
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
showTimeSelectOnlyis enabled.Changes Made:
showTimeSelectOnlyusing React Test Library