fix crash when enter is used to submit empty date in date picker (#5423)

This commit is contained in:
Julian
2025-08-01 05:19:54 +02:00
committed by GitHub
parent 1a1975b5ab
commit 4cdff76547
2 changed files with 12 additions and 4 deletions

View File

@@ -346,11 +346,13 @@ export function DateSelect({
onUpdate?.(defaultValue);
}
} else if (shouldSaveFromKey(e)) {
setValue(selectedValue);
setOpen(false);
if (selectedValue) {
setValue(selectedValue);
const date = parse(selectedValue, dateFormat, new Date());
onSelect(format(date, 'yyyy-MM-dd'));
}
const date = parse(selectedValue, dateFormat, new Date());
onSelect(format(date, 'yyyy-MM-dd'));
setOpen(false);
if (open && e.key === 'Enter') {
// This stops the event from propagating up

View File

@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [Serializator]
---
Fix crash when the enter key is used to submit an empty date to the date picker