Repository navigation
fix(forms): treat cleared date input as empty value - #67363
angular-bootstrap wants to merge 2 commits into
Conversation
When a date input is manually cleared, the browser can report an empty value while badInput is stale. Treat an empty date control as no value so signal forms update the model and clear parse errors instead of retaining the previous date. This restores submit behavior for optional fields and allows required validation to surface normally. Fixes angular#67300
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
CLA is signed and fix is ready. Could a maintainer please add the required target label(s) and trigger google-internal presubmit? Thanks. |
|
Thanks for the suggestion but this is not a change we'd like to have. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
When a date input is manually cleared, the browser can report an empty value while
badInputis stale. Treat an empty date control as no value so signal forms update the model and clear parse errors instead of retaining the previous date. This restores submit behavior for optional fields and allows required validation to surface normally.Fixes #67300
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
For signal forms with
<input type="date">, after entering a valid date and then manually clearing the input, a parse error can persist and the previous valid date value is retained. Optional date fields then become impossible to submit once filled at least once.Issue Number: #67300
What is the new behavior?
When
input[type="date"]hasvalue === '', signal forms treat it as a cleared value (''ornulldepending on model shape) and clear parse errors. Optional fields submit again after clearing, and required fields fail with required validation instead of a stuck parse error.Does this PR introduce a breaking change?
Other information
Regression introduced in v21.2.0 by native input parsing support in #66917.