I used calendar component from PrimeNG, I used timeOnly
property to display only the time, I have a string like 12:10
.
I want to set this string into the calendar, is it necessary to convert it to date or is there another way to do it?
<p-calendar [timeOnly]="true" formControlName="ms" (onSelect)="compareTwoTimesM()" placeholder="hh:mm">
Yes, you can create a date and set it hours and minutes like that :
let input = '12:10';
let tmp = input.split(':');
this.ms = new Date();
this.ms.setHours(parseInt(tmp[0]));
this.ms.setMinutes(parseInt(tmp[1]));