Converted Date to Moment. Since Datepicker is already using Moment adapter
This commit is contained in:
@@ -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'),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user