-
Notifications
You must be signed in to change notification settings - Fork 2.3k
🚑 Fix the problem where pressing Enter after deleting a value in the custom input results in the first value being incorrectly formatted as '2001'. #5292
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
Conversation
…custom input results in the first value being incorrectly formatted as '2001'.
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 for review. Expert reviewers are now being matched to your request based on the code's requirements. Stay tuned!
What to expect from this code review:
- Comments posted to any areas of potential concern or improvement.
- Detailed feedback or actions needed to resolve issues that are found.
- Turnaround times vary, but we aim to be swift.
@ftrdzputrap 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
+ 2
- 0
100% TSX
Type of change
Fix - These changes are likely to be fixing a bug or issue.
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.
It may be worth switching from casting to a type guard (if (event.target instanceof HTMLInputElement) { ... }
) and handling the case where that isn't true, in order to help avoid future bugs. Other than that, this seems pretty straightforward and looks good to me.
Ryan Lester <@buu700>
Reviewed with ❤️ by PullRequest
so i must handle this event using instanceof HTMLInputElement to get approval? or is there another way? |
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.
It may be worth switching from casting to a type guard (
if (event.target instanceof HTMLInputElement) { ... }
) and handling the case where that isn't true, in order to help avoid future bugs. Other than that, this seems pretty straightforward and looks good to me.Reviewed with ❤️ by PullRequest
so i must handle this event using instanceof HTMLInputElement to get approval? or is there another way?
It's just a suggestion that may help make the code more robust, but ultimately it's up to you. If you prefer to use casting and already know for sure that the element in question is an input, that seems fine too.
Ryan Lester <@buu700>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5292 +/- ##
=======================================
Coverage 96.92% 96.92%
=======================================
Files 29 29
Lines 3377 3379 +2
Branches 1400 1417 +17
=======================================
+ Hits 3273 3275 +2
+ Misses 104 102 -2
- Partials 0 2 +2 ☔ View full report in Codecov by Sentry. |
I have an issue where, after typing the year and pressing Enter in the customInput field of React Datepicker, the value is automatically formatted when I delete it.
I'm handling the issue by blurring the field when Enter or Escape is pressed, and ensuring the selected value is preserved.