Angular PrimeNG p-calendar reactive form on patchValue error Unexpected literal at position 2

In Angular 13 application, using PrimeNG Calendar

<p-calendar [minDate]="today" [showIcon]="true" styleClass="form-control" showButtonBar="true"
                                dateFormat="dd/mm/yy" inputId="icon" placeholder="dd/mm/yy"
                                formControlName="eventStartDate"></p-calendar>

using in a Reactive form, it is working fine while save new form.same form I am using for edit also. To edit the form loading the data based on code. But while patchValue to the form, getting the error ERROR Unexpected literal at position 2 enter image description here

the edit code

loadEventToEdit() {
    this.eventService.getEventByCode(this.eventCode).subscribe((res) => {
      this.event = res;
      console.log('the event to update', this.event);

      this.theForm.patchValue(res);

Rest of fileds path value is working fine.


Give complete way to your res where res have to patched. For FormArray you have to make getter first and the can you use Push or insert method to patch with form array

 loadEventToEdit() {
        this.eventService.getEventByCode(this.eventCode).subscribe((res) => {
          this.event = res;
         this.theForm.controls['eventStartDate'].patchValue(this.event.timing.eventStartDate);
    })
    }