Converted Date to Moment. Since Datepicker is already using Moment adapter
This commit is contained in:
@@ -45,8 +45,8 @@ export class PurchasesComponent implements OnInit {
|
||||
info: Purchases = new Purchases();
|
||||
dataSource: PurchasesDataSource = new PurchasesDataSource(this.info.body, this.paginator, this.sort);
|
||||
form: FormGroup<{
|
||||
startDate: FormControl<Date>;
|
||||
finishDate: FormControl<Date>;
|
||||
startDate: FormControl<moment.Moment>;
|
||||
finishDate: FormControl<moment.Moment>;
|
||||
}>;
|
||||
|
||||
selectedRowId = '';
|
||||
@@ -62,8 +62,8 @@ export class PurchasesComponent implements OnInit {
|
||||
|
||||
constructor() {
|
||||
this.form = new FormGroup({
|
||||
startDate: new FormControl(new Date(), { nonNullable: true }),
|
||||
finishDate: new FormControl(new Date(), { nonNullable: true }),
|
||||
startDate: new FormControl(moment(new Date()), { nonNullable: true }),
|
||||
finishDate: new FormControl(moment(new Date()), { nonNullable: true }),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -73,8 +73,8 @@ export class PurchasesComponent implements OnInit {
|
||||
|
||||
this.info = data.info;
|
||||
this.form.setValue({
|
||||
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
|
||||
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(),
|
||||
startDate: moment(this.info.startDate, 'DD-MMM-YYYY'),
|
||||
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY'),
|
||||
});
|
||||
this.dataSource = new PurchasesDataSource(this.info.body, this.paginator, this.sort);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user