Components/create-edit-modal: don't add date form control separately
This commit is contained in:
parent
2de5b804af
commit
58bb2cb3ca
1 changed files with 7 additions and 7 deletions
|
|
@ -31,18 +31,18 @@ export class CreateEditModalComponent {
|
||||||
|
|
||||||
private initForm() {
|
private initForm() {
|
||||||
let formattedDate: string
|
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) {
|
if (this.show?.date !== undefined) {
|
||||||
formattedDate = formatDate(this.show?.date, "YYYY-MM-dd", "en")
|
formattedDate = formatDate(this.show?.date, "YYYY-MM-dd", "en")
|
||||||
} else {
|
} else {
|
||||||
formattedDate = ""
|
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() {
|
protected dismiss() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue