fix(pickers): fire onError when dates are partially filled#22040
Open
M-Anastasia wants to merge 6 commits intomui:masterfrom
Open
fix(pickers): fire onError when dates are partially filled#22040M-Anastasia wants to merge 6 commits intomui:masterfrom
M-Anastasia wants to merge 6 commits intomui:masterfrom
Conversation
added 5 commits
April 6, 2026 19:32
…ially-filled-date # Conflicts: # packages/x-date-pickers-pro/src/hooks/useMultiInputRangeField/useMultiInputRangeField.ts # packages/x-date-pickers-pro/src/hooks/useMultiInputRangeField/useTextFieldProps.ts # packages/x-date-pickers/src/DateField/tests/blurPartialFilling.DateField.test.tsx # packages/x-date-pickers/src/DateField/tests/invalidStateKeyboard.DateField.test.tsx
|
Deploy preview: https://deploy-preview-22040--material-ui-x.netlify.app/ Bundle size report
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #17499 Supersedes #17514
Summary
Restores the partiallyFilledDate validation behavior from v7. Previously, if a user started typing a date (e.g., entering only the month) no validation error was triggered, and the onError callback was not fired.
This PR reintroduces this validation logic by tracking the partial fill state at the field level and passing it through the validation pipeline. It is based on the initial approach in #17514 but has been adapted to handle both single and range pickers correctly.
Changes
Added 'partiallyFilledDate' to CommonDateTimeValidationError type.
Added getIsPartiallyFilled method to valueManagers implementations (singleItemFieldValueManager and getRangeFieldValueManager) to accurately calculate if sections are partially filled.
Propagated isPartiallyFilled state through PickerPrivateContext so it can be accessed by validation hooks.
Updated Validator type signature and all validation functions (validateDate, validateTime, validateDateTime, validateDateRange, validateDateTimeRange) to accept and return early on partiallyFilledDate if the field is partially filled.
Test coverage
before:
2026-04-09.11.20.43.mov
after:
2026-04-09.11.18.27.mov