Skip to content

Commit 884b03d

Browse files
authored
5439 dbinput inserting an empty string doesnt empty date form fields (#5440)
* docs: adapted solution * fix(input[type="date"]): resetting a field by the empty string
1 parent 82adc6f commit 884b03d

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

.changeset/orange-eyes-pump.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@db-ux/ngx-core-components": patch
3+
---
4+
5+
DBInput: inserting an empty string doesn't reset/empty date or time related form fields

packages/components/scripts/post-build/components.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ export const getComponents = (): Component[] => [
368368
from: 'writeValue(value: any) {',
369369
to:
370370
'writeValue(value: any) {\n' +
371-
'if (!value && (this.type() === "date" ||\n' +
371+
'if (!value && value !== "" && (this.type() === "date" ||\n' +
372372
' this.type() === "time" ||\n' +
373373
' this.type() === "week" ||\n' +
374374
' this.type() === "month" ||\n' +

showcases/angular-showcase/src/app/components/form/form.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export class FormComponent {
111111
this.model.checkbox2 = false;
112112
this.form.get('input')?.setValue('reset');
113113
this.form.get('textarea')?.setValue('reset');
114-
this.form.get('dateinput')?.setValue('reset');
114+
this.form.get('dateinput')?.setValue('');
115115
this.form.get('checkbox')?.setValue(false);
116116
}
117117

0 commit comments

Comments
 (0)