Skip to content

fix(forms): treat cleared date input as empty value - #67363

Closed
angular-bootstrap wants to merge 2 commits into
angular:mainfrom
angular-bootstrap:fix-date-input-parse-error
Closed

angular-bootstrap wants to merge 2 commits into
angular:mainfrom
angular-bootstrap:fix-date-input-parse-error

Conversation

@angular-bootstrap

Copy link
Copy Markdown
Contributor

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 #67300

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

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"] has value === '', signal forms treat it as a cleared value ('' or null depending 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?

  • Yes
  • No

Other information

Regression introduced in v21.2.0 by native input parsing support in #66917.

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
@pullapprove
pullapprove Bot requested a review from JeanMeche February 28, 2026 01:46
@google-cla

google-cla Bot commented Feb 28, 2026

Copy link
Copy Markdown

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.

@angular-robot angular-robot Bot added the area: build & ci Related the build and CI infrastructure of the project label Feb 28, 2026
@angular-bootstrap

Copy link
Copy Markdown
Contributor Author

CLA is signed and fix is ready. Could a maintainer please add the required target label(s) and trigger google-internal presubmit? Thanks.

@JeanMeche

Copy link
Copy Markdown
Member

Thanks for the suggestion but this is not a change we'd like to have.

@JeanMeche JeanMeche closed this Feb 28, 2026
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Mar 31, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: build & ci Related the build and CI infrastructure of the project area: forms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

regression: signal forms: input of type date isn't required anymore when cleared

2 participants