From 876b253defe7e098320f20b2418f3b6f4f0de016 Mon Sep 17 00:00:00 2001 From: fitraradza Date: Fri, 27 Dec 2024 14:29:11 +0700 Subject: [PATCH] :ambulance: Fix the problem where pressing Enter after deleting a value in the custom input results in the first value being incorrectly formatted as '2001'. --- src/index.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/index.tsx b/src/index.tsx index 9277d9f2db..ad41381afb 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -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 @@ -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) {