-
Notifications
You must be signed in to change notification settings - Fork 13
fix(dbinput): inserting an empty string doesn't reset date form fields #5440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(dbinput): inserting an empty string doesn't reset date form fields #5440
Conversation
🦋 Changeset detectedLatest commit: 08691bf The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug where setting an empty string value on Angular date input fields would not clear the field, which differs from the native HTML input[type="date"] behavior. The fix modifies the writeValue method's condition to allow empty strings to pass through and clear date-related input types.
- Modified the Angular-specific
writeValueoverwrite to not return early when an empty string is passed for date/time input types - Updated the Angular showcase to demonstrate resetting date inputs with an empty string
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/components/scripts/post-build/components.ts | Fixed the condition in the Angular writeValue overwrite to allow empty strings to clear date/time/week/month/datetime-local inputs |
| showcases/angular-showcase/src/app/components/form/form.component.ts | Updated the resetValues method to reset the date input field to an empty string instead of 'reset' |
…t-empty-date-form-fields
…t-empty-date-form-fields
Proposed changes
The condition for resetting a date related input wouldn't accept the empty string as a valid value, whereas this works perfectly fine with a native
input[type="date"]HTML element.resolves #5439
Types of changes
Further comments
🔭🐙🐈 Test this branch here: https://design-system.deutschebahn.com/core-web/review/5439-dbinput-inserting-an-empty-string-doesnt-empty-date-form-fields