Converted Date to Moment. Since Datepicker is already using Moment adapter
This commit is contained in:
+3
-3
@@ -39,7 +39,7 @@ export class RecipeTemplateDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement!: ElementRef<HTMLInputElement>;
|
||||
form: FormGroup<{
|
||||
name: FormControl<string>;
|
||||
date: FormControl<Date>;
|
||||
date: FormControl<moment.Moment>;
|
||||
text: FormControl<string>;
|
||||
selected: FormControl<boolean>;
|
||||
}>;
|
||||
@@ -49,7 +49,7 @@ export class RecipeTemplateDetailComponent implements OnInit, AfterViewInit {
|
||||
constructor() {
|
||||
this.form = new FormGroup({
|
||||
name: new FormControl<string>('', { nonNullable: true }),
|
||||
date: new FormControl(new Date(), { nonNullable: true }),
|
||||
date: new FormControl(moment(new Date()), { nonNullable: true }),
|
||||
text: new FormControl<string>('', { nonNullable: true }),
|
||||
selected: new FormControl<boolean>(false, { nonNullable: true }),
|
||||
});
|
||||
@@ -67,7 +67,7 @@ export class RecipeTemplateDetailComponent implements OnInit, AfterViewInit {
|
||||
this.item = item;
|
||||
this.form.setValue({
|
||||
name: this.item.name,
|
||||
date: moment(this.item.date, 'DD-MMM-YYYY').toDate(),
|
||||
date: moment(this.item.date, 'DD-MMM-YYYY'),
|
||||
text: this.item.text,
|
||||
selected: this.item.selected,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user