Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
940 views
in Technique[技术] by (71.8m points)

javascript - 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>
question from:https://stackoverflow.com/questions/65913489/is-there-any-event-of-primeng-p-calendar-which-executed-on-time-change

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...