When I select the date from the pop up ,it is not getting selected and none of the change event is getting triggered.I have upgrade primeng from 10.0.3 to 16.2.0

my html

<p-calendar #calendar (ngModelChange)="onDateChange($event)" [ngModel]="value" [dateFormat]="dateFormat" [showTime]="showTime"
[hourFormat]="hourFormat" [readonlyInput]="readOnlyInput" [minDate]="minDate"
[maxDate]="maxDate" [inputId]="inputId" [name]="name" [placeholder]="placeholder"
[showIcon]="showIcon" [icon]="icon" [selectionMode]="selectionMode"
[defaultDate]="defaultDate" [disabled]="disabled" [touchUI]="touchUI" [timeOnly]="timeOnly"
[monthNavigator]="true" [yearNavigator]="true" appendTo="body"
yearRange="1970:2050" inputStyleClass="form-control"></p-calendar>

my ts

export class CatalystDatepickerComponent implements OnInit, ControlValueAccessor {
    @Input() dateFormat: string = 'mm/dd/yy';
    @Input() showTime: boolean;
    @Input() timeOnly: boolean;
    @Input() hourFormat: string = '24';
    @Input() readOnlyInput: boolean;
    @Input() minDate: Date;
    @Input() maxDate: Date;
    @Input() inputId: string;
    @Input() name: string;
    @Input() placeholder: string;
    @Input() showIcon: boolean;
    @Input() icon = 'pi pi-calendar';
    @Input() selectionMode:'single';
    @Input() defaultDate: Date;
    @Input() disabled: boolean;
    @Input() touchUI: boolean;

    @Output() selectEvent = new EventEmitter<Date>();
    @Output() inputEvent = new EventEmitter<Event>();

    @ViewChild("calendar") calendarRef: Calendar;

    value: Date;
    model: any;

    onModelChange: Function = () => { };
   
    onModelTouched: Function = () => { };
    constructor(private cd: ChangeDetectorRef) { }

    ngOnInit() {
    }
    onDateChange(value: Date): void {
        this.writeValue(value); 
        this.onModelChange(value); 
    }
    writeValue(obj: any): void {
        if (obj != this.value) {
            this.value = obj;
            this.cd.markForCheck();
        }
    }
    registerOnChange(fn: any): void {
        this.onModelChange = fn;
    }
    registerOnTouched(fn: any): void {
        this.onModelTouched = fn;
    }
    setDisabledState?(isDisabled: boolean): void {
        this.disabled = isDisabled;
    }

    clearCalendar() {
        this.calendarRef.onClearButtonClick(null);
    }
}

I am not sure what exactly is the issue.There are no console errors as well when i select the date.I am able to select month and year but not date

0

There are 0 best solutions below