Converted Date to Moment. Since Datepicker is already using Moment adapter
This commit is contained in:
@@ -63,7 +63,7 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
|
||||
public itemsObservable = new BehaviorSubject<RecipeItem[]>([]);
|
||||
dataSource: RecipeDetailDatasource = new RecipeDetailDatasource(this.itemsObservable);
|
||||
form: FormGroup<{
|
||||
date: FormControl<Date>;
|
||||
date: FormControl<moment.Moment>;
|
||||
source: FormControl<string>;
|
||||
recipeYield: FormControl<string | null>;
|
||||
product: FormControl<ProductSku | string | null>;
|
||||
@@ -90,7 +90,7 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
|
||||
this.product = null;
|
||||
this.ingredient = null;
|
||||
this.form = new FormGroup({
|
||||
date: new FormControl(new Date(), { nonNullable: true }),
|
||||
date: new FormControl(moment(new Date()), { nonNullable: true }),
|
||||
source: new FormControl('', { nonNullable: true }),
|
||||
recipeYield: new FormControl<string | null>(null),
|
||||
product: new FormControl<ProductSku | string | null>(new ProductSku()),
|
||||
@@ -132,7 +132,7 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
|
||||
showItem(item: Recipe) {
|
||||
this.item = item;
|
||||
this.form.setValue({
|
||||
date: moment(item.date, 'DD-MMM-YYYY').toDate(),
|
||||
date: moment(item.date, 'DD-MMM-YYYY'),
|
||||
source: item.source,
|
||||
recipeYield: `${item.recipeYield}`,
|
||||
product: item.sku,
|
||||
|
||||
Reference in New Issue
Block a user