I have integrated the p-calendar
component into my application to allow users to input a specific time. The calendar functions properly, but I am encountering an issue where when I select a new date on the calendar, the previous date remains selected as well. This gives the appearance that both dates are selected simultaneously. How can I resolve this problem? Thank you for any assistance you can provide.
Below is the code snippet from my template:
<div class="p-field p-col-12 p-md-4">
<p-calendar [defaultDate]="null" [showButtonBar]="true" [maxDate]="maxDateValue" [readonlyInput]="true" [(ngModel)]="date7" [showTime]="true" [inline]="true" inputId="time"></p-calendar>
</div>
<span style="font-size: small;"> Selected Time::</span><span style="font-size: small;"><u>{{date7}}</u></span>
The value in the variable date7 corresponds to the newly selected date, as it should. However, the issue persists with both dates appearing selected on the calendar display.