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

Calendar V19 and V18: showTime/timeOnly with minDate/minTime creates inconsistencies and bad behavior #17420

Open
2 of 4 tasks
Guigeek973 opened this issue Jan 17, 2025 · 1 comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@Guigeek973
Copy link

Guigeek973 commented Jan 17, 2025

Describe the bug

Hello everyone,

I've seen this bug in many closed issues but this is still not resolved both in v18 and v19 (I didn't tested on v17)

I set a minDate on a p-date-picker timeOnly and it's not respected.
It doesn't happen for all hours and it doesn't happen for minutes.
It happens both with a format=“12” and a format=“24”.

I've made a stackblitz to reproduce the error.
https://stackblitz.com/edit/stackblitz-starters-to16yc9k?file=src%2Fmain.ts

Example: it's 9:30 AM and i set a minTime with a value of 9:30.
When I try to lower the minutes I'm correctly blocked.
But if I lower the hours, these are displayed in the following order:
11:30 PM => 10:30 PM => 09:30 PM etc
Note that I can also change the meridiem (AM - PM)

I'm going to setup a stackblitz with the latest version of primeNG to know if it's resolved, and if i need to update to v19...

EDIT : i've just tested on v19 and still the same bad behavior
https://stackblitz.com/edit/stackblitz-starters-ipzbshrh?file=package.json

NOTE that when i move down the hour, i can then move down also the minutes..

Pull Request Link

No response

Reason for not contributing a PR

  • Lack of time
  • Unsure how to implement the fix/feature
  • Difficulty understanding the codebase
  • Other

Other Reason

No response

Reproducer

https://stackblitz.com/edit/stackblitz-starters-ipzbshrh?file=package.json

Environment

Angular 19 and prime ng19 but it also dont work on v18

Angular version

19

PrimeNG version

v19

Node version

22.12.0

Browser(s)

No response

Steps to reproduce the behavior

  1. it's 9:30 AM and i set a minTime with a value of 9:30.
  2. When I try to lower the minutes I'm correctly blocked.
  3. But if I lower the hours, these are displayed in the following order: 11:30 PM => 10:30 PM => 09:30 PM etc
  4. It is really weird, i want to lower the hours, and the time is finally upraised to the last time of the morning

Expected behavior

When I set a minDate with minTime 09:30, i need the time picker to follow the rule and prevent user to lower the hours or minutes and prevent to change the meridiem (AM or PM)
Now when i lower the hour, it upraise the hour by putting the meridiem to PM.
I have tested in multiple ways, the rule is respected but it's really weird to change the time by clicking on lower hour...
I mean i think for the user it's cleaner to only allow him to upraise the time, or down the time until the minTime is met.

@Guigeek973 Guigeek973 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 17, 2025
@Guigeek973 Guigeek973 changed the title Calendar V19 and V18: showTime or timeOnly with minDate creates inconsistencies and bad behavior Calendar V19 and V18: showTime/timeOnly with minDate creates inconsistencies and bad behavior Jan 17, 2025
@Guigeek973 Guigeek973 changed the title Calendar V19 and V18: showTime/timeOnly with minDate creates inconsistencies and bad behavior Calendar V19 and V18: showTime/timeOnly with minDate/minTime creates inconsistencies and bad behavior Jan 17, 2025
@Guigeek973
Copy link
Author

It seems like this is a feature, but the feature give a really weird behavior.

If i lower the hour, the hour is raised to 11 if it's the morning and then i can lower to my initial morning minTime.

I think it will be better for the user to just block the lowering of hours when minTime is met.

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