Component: Calendar - MinDate issue: Hour can be set to 11 when MinDate hours == 12 #16443
Labels
Status: Needs Triage
Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Describe the bug
When you set the MinTime of p-calendar to 12, it allows to go to 11.
HTML
<p-calendar [timeOnly]="true" [minDate]="getMinDateTime()">
TS
getMinDateTime()
var date = new Date();
date.setHours(12);
date.setMinutes(0);
return date;
BUG
You can set the time to 11:00
SOURCE CODE
Check Calendar.ts in src/app/components/calendar/
Method constrainTime
See this line:
case isMinDate && minHoursExceeds12 && this.minDate.getHours() === 12 && this.minDate.getHours() > convertedHour:
returnTimeTriple[0] = 11;
Is this not the bug or am I looking at it wrong?
Environment
I don't know what I should specify here
Reproducer
https://stackblitz.com/edit/github-5eeyk6?file=src%2Fapp%2Fapp.component.html
Angular version
18.2.3
PrimeNG version
17.18.9
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
20.11.1
Browser(s)
No response
Steps to reproduce the behavior
Expected behavior
Mintime should be 12 when set to 12
The text was updated successfully, but these errors were encountered: