Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/components/date_picker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ const DatePicker = ({

const isValidDate = value instanceof Date && isValid(value);

onChange?.(value);
// Only push a complete valid date or a fully cleared field up to the parent.
// A partial manual entry (e.g. while typing the year) arrives as an Invalid
// Date and would otherwise clear the stored value.
if (isValidDate || value === null) {
onChange?.(value);
}

if (view === 'input' && !open && isValidDate) {
setOpen(false);
Expand Down