Purvang Gor
Purvang Gor

Reputation: 118

Is there any event of PrimeNg p-calendar which executed on TIME change?

I have used PrimeNg v5.2.7 for From Date and To Date in my project and also gave minDate validation in To Date but if I choose From Date 30th jan 2021 and only change time in To Date then today's date 27th jan 2021 is getting selected in To Date which is wrong senario

    <p-calendar class="date" [minDate]="null!=model.start_date?model.start_date:dateTime"
[(ngModel)]="model.end_date"
[showIcon]="true" [showTime]="true"                                                                           showButtonBar="true"                                             [formControl]="form.controls['end_date']"
(onSelect)="onChangeEndDate()" [readonlyInput]="true"></p-calendar>

Upvotes: 1

Views: 7954

Answers (1)

Msk Satheesh
Msk Satheesh

Reputation: 1536

Try using:

You can (ngModelChange) in your calender. it will trigger when value of the field get changes.

<p-calendar class="date" [minDate]="null!=model.start_date?model.start_date:dateTime"
[(ngModel)]="model.end_date"
[showIcon]="true" [showTime]="true"                                                                           showButtonBar="true"                                             [formControl]="form.controls['end_date']"
(onSelect)="onChangeEndDate()" (ngModelChange)="onChangeEndDate()" [readonlyInput]="true"></p-calendar>

I think this will help you...

Upvotes: 1

Related Questions