Converted Date to Moment. Since Datepicker is already using Moment adapter
This commit is contained in:
@@ -56,7 +56,7 @@ export class IncentiveComponent implements OnInit {
|
||||
public incentiveObservable = new BehaviorSubject<Incentive[]>([]);
|
||||
dataSource: IncentiveDataSource = new IncentiveDataSource(this.incentiveObservable);
|
||||
form: FormGroup<{
|
||||
date: FormControl<Date>;
|
||||
date: FormControl<moment.Moment>;
|
||||
incentives: FormArray<
|
||||
FormGroup<{
|
||||
points: FormControl<number>;
|
||||
@@ -79,7 +79,7 @@ export class IncentiveComponent implements OnInit {
|
||||
|
||||
constructor() {
|
||||
this.form = new FormGroup({
|
||||
date: new FormControl(new Date(), { nonNullable: true }),
|
||||
date: new FormControl(moment(new Date()), { nonNullable: true }),
|
||||
incentives: new FormArray<FormGroup<{ points: FormControl<number> }>>([]),
|
||||
});
|
||||
// Listen to Date Change
|
||||
@@ -103,7 +103,7 @@ export class IncentiveComponent implements OnInit {
|
||||
|
||||
loadVoucher(voucher: Voucher) {
|
||||
this.voucher = voucher;
|
||||
this.form.controls.date.setValue(moment(this.voucher.date, 'DD-MMM-YYYY').toDate());
|
||||
this.form.controls.date.setValue(moment(this.voucher.date, 'DD-MMM-YYYY'));
|
||||
this.form.controls.incentives.clear();
|
||||
this.voucher.incentives.forEach((x) =>
|
||||
this.form.controls.incentives.push(
|
||||
|
||||
Reference in New Issue
Block a user