Converted Date to Moment. Since Datepicker is already using Moment adapter

This commit is contained in:
2025-07-15 19:04:35 +00:00
parent d3588977a5
commit c542114e42
25 changed files with 126 additions and 126 deletions
@@ -36,8 +36,8 @@ export class PeriodDetailComponent implements OnInit {
@ViewChild('startDateElement', { static: true }) startDate!: ElementRef<HTMLInputElement>;
form: FormGroup<{
validFrom: FormControl<Date>;
validTill: FormControl<Date>;
validFrom: FormControl<moment.Moment>;
validTill: FormControl<moment.Moment>;
}>;
item: Period = new Period();
@@ -51,8 +51,8 @@ export class PeriodDetailComponent implements OnInit {
constructor() {
this.form = new FormGroup({
validFrom: new FormControl(new Date(), { nonNullable: true }),
validTill: new FormControl(new Date(), { nonNullable: true }),
validFrom: new FormControl(moment(new Date()), { nonNullable: true }),
validTill: new FormControl(moment(new Date()), { nonNullable: true }),
});
}
@@ -67,8 +67,8 @@ export class PeriodDetailComponent implements OnInit {
showItem(item: Period) {
this.item = item;
this.form.setValue({
validFrom: moment(this.item.validFrom, 'DD-MMM-YYYY').toDate(),
validTill: moment(this.item.validTill, 'DD-MMM-YYYY').toDate(),
validFrom: moment(this.item.validFrom, 'DD-MMM-YYYY'),
validTill: moment(this.item.validTill, 'DD-MMM-YYYY'),
});
}