Converted Date to Moment. Since Datepicker is already using Moment adapter
This commit is contained in:
@@ -63,7 +63,7 @@ export class ClosingStockComponent implements OnInit {
|
||||
info: ClosingStock = new ClosingStock();
|
||||
dataSource: ClosingStockDataSource = new ClosingStockDataSource(this.info.items, this.paginator, this.sort);
|
||||
form: FormGroup<{
|
||||
date: FormControl<Date>;
|
||||
date: FormControl<moment.Moment>;
|
||||
costCentre: FormControl<string | null>;
|
||||
stocks: FormArray<
|
||||
FormGroup<{
|
||||
@@ -88,7 +88,7 @@ export class ClosingStockComponent implements OnInit {
|
||||
constructor() {
|
||||
this.costCentres = [];
|
||||
this.form = new FormGroup({
|
||||
date: new FormControl(new Date(), { nonNullable: true }),
|
||||
date: new FormControl(moment(new Date()), { nonNullable: true }),
|
||||
costCentre: new FormControl<string | null>(null),
|
||||
stocks: new FormArray<FormGroup<{ physical: FormControl<number>; costCentre: FormControl<string | undefined> }>>(
|
||||
[],
|
||||
@@ -102,7 +102,7 @@ export class ClosingStockComponent implements OnInit {
|
||||
this.info = data.info;
|
||||
this.costCentres = data.costCentres;
|
||||
this.form.patchValue({
|
||||
date: moment(this.info.date, 'DD-MMM-YYYY').toDate(),
|
||||
date: moment(this.info.date, 'DD-MMM-YYYY'),
|
||||
costCentre: this.info.costCentre.id,
|
||||
});
|
||||
this.form.controls.stocks.clear();
|
||||
|
||||
Reference in New Issue
Block a user