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() {