Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component: Calendar - MinDate issue: Hour can be set to 11 when MinDate hours == 12 #16443

Open
steun86 opened this issue Sep 26, 2024 · 0 comments
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@steun86
Copy link

steun86 commented Sep 26, 2024

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

  1. Click on the calendar box, you will see the time selection appear
  2. Click on the down arrow, time will change
  3. You can go to 11 while mintime is set to 12

Expected behavior

Mintime should be 12 when set to 12

@steun86 steun86 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Sep 26, 2024
@steun86 steun86 changed the title Component: Calendar - MinDate issue: Hour can be set to 11 when MinDate.getHours()= 12 Component: Calendar - MinDate issue: Hour can be set to 11 when MinDate hours == 12 Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

1 participant