Skip to content

Commit

Permalink
chore(demo): InputDateTime simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
mdlufy committed Nov 26, 2024
1 parent ba67cf7 commit 9571a7b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<form [formGroup]="testForm">
<tui-input-date-time formControlName="testValue">Choose date and time</tui-input-date-time>
<tui-error
formControlName="testValue"
[error]="[] | tuiFieldError | async"
></tui-error>
<tui-input-date-time [formControl]="control">Choose date and time</tui-input-date-time>
<tui-error
[error]="[] | tuiFieldError | async"
[formControl]="control"
></tui-error>

<p>Form value:</p>
<p>Form value:</p>

<pre><code>{{ testForm.value | json }}</code></pre>
</form>
<pre><code>{{ control.value | json }}</code></pre>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {Component} from '@angular/core';
import {
AbstractControl,
FormControl,
FormGroup,
ReactiveFormsModule,
type ValidationErrors,
type ValidatorFn,
Expand Down Expand Up @@ -35,10 +34,8 @@ const completeDateTimeValidator: ValidatorFn = (
changeDetection,
})
export default class Example {
protected readonly testForm = new FormGroup({
testValue: new FormControl(
[new TuiDay(2017, 2, 15), null],
completeDateTimeValidator,
),
});
protected readonly control = new FormControl(
[new TuiDay(2017, 2, 15), null],
completeDateTimeValidator,
);
}

0 comments on commit 9571a7b

Please sign in to comment.