Skip to content

Commit

Permalink
🚑 Fix the problem where pressing Enter after deleting a value in the …
Browse files Browse the repository at this point in the history
…custom input results in the first value being incorrectly formatted as '2001'.
  • Loading branch information
ftrdzputrap committed Dec 27, 2024
1 parent 407051c commit 876b253
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,7 @@ export default class DatePicker extends Component<
const copy = newDate(this.state.preSelection);
if (eventKey === KeyType.Enter) {
event.preventDefault();
(event.target as HTMLInputElement).blur();
if (
this.inputOk() &&
this.state.lastPreSelectChange === PRESELECT_CHANGE_VIA_NAVIGATE
Expand All @@ -973,6 +974,7 @@ export default class DatePicker extends Component<
}
} else if (eventKey === KeyType.Escape) {
event.preventDefault();
(event.target as HTMLInputElement).blur();
this.sendFocusBackToInput();
this.setOpen(false);
} else if (eventKey === KeyType.Tab) {
Expand Down

0 comments on commit 876b253

Please sign in to comment.