Skip to content

Commit 876b253

Browse files
committed
🚑 Fix the problem where pressing Enter after deleting a value in the custom input results in the first value being incorrectly formatted as '2001'.
1 parent 407051c commit 876b253

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,7 @@ export default class DatePicker extends Component<
962962
const copy = newDate(this.state.preSelection);
963963
if (eventKey === KeyType.Enter) {
964964
event.preventDefault();
965+
(event.target as HTMLInputElement).blur();
965966
if (
966967
this.inputOk() &&
967968
this.state.lastPreSelectChange === PRESELECT_CHANGE_VIA_NAVIGATE
@@ -973,6 +974,7 @@ export default class DatePicker extends Component<
973974
}
974975
} else if (eventKey === KeyType.Escape) {
975976
event.preventDefault();
977+
(event.target as HTMLInputElement).blur();
976978
this.sendFocusBackToInput();
977979
this.setOpen(false);
978980
} else if (eventKey === KeyType.Tab) {

0 commit comments

Comments
 (0)