From 58bb2cb3ca9d49f116cad5ef855df3e78c15ba9e Mon Sep 17 00:00:00 2001 From: Toast Date: Thu, 6 Feb 2025 17:25:02 +0100 Subject: [PATCH] Components/create-edit-modal: don't add date form control separately --- .../create-edit-modal.component.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/create-edit-modal/create-edit-modal.component.ts b/src/components/create-edit-modal/create-edit-modal.component.ts index 586c624..3570ebc 100644 --- a/src/components/create-edit-modal/create-edit-modal.component.ts +++ b/src/components/create-edit-modal/create-edit-modal.component.ts @@ -31,18 +31,18 @@ export class CreateEditModalComponent { private initForm() { let formattedDate: string - this.newShowForm = new FormGroup({ - title: new FormControl(this.show?.title, Validators.required), - seasons: new FormControl(this.show?.seasons, [Validators.required, Validators.min(1)]), - episodes: new FormControl(this.show?.episodes, [Validators.required, Validators.min(1)]), - description: new FormControl(this.show?.description, Validators.required) - }) if (this.show?.date !== undefined) { formattedDate = formatDate(this.show?.date, "YYYY-MM-dd", "en") } else { formattedDate = "" } - this.newShowForm.addControl("date", new FormControl(formattedDate, Validators.required)) + this.newShowForm = new FormGroup({ + title: new FormControl(this.show?.title, Validators.required), + seasons: new FormControl(this.show?.seasons, [Validators.required, Validators.min(1)]), + date: new FormControl(formattedDate, Validators.required), + episodes: new FormControl(this.show?.episodes, [Validators.required, Validators.min(1)]), + description: new FormControl(this.show?.description, Validators.required) + }) } protected dismiss() {