Component: Calendar sets seconds to current seconds even if showSeconds=false #14626
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 using a time but not seconds, the seconds are still set as part of
selectDate()
. This will mean if an end user selects the same date twice the dates may not be equal to each other due to the seconds component of the time. This may lead to confusing behaviour such as the period between two times being a fractional number of minutes.Without testing locally, my guess is the line:
date.setSeconds(<number>this.currentSecond);
Should be updated to:
date.setSeconds(this.showSeconds ? <number>this.currentSecond : 0);
So that seconds are not set to anything other than zero if they are not being displayed to the user.
Environment
NodeJS 18.17.1
Angular 17.1.1
PrimeNG 17.4.0
Reproducer
No response
Angular version
17.1.1
PrimeNG version
17.4.0
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
18.17
Browser(s)
No response
Steps to reproduce the behavior
Expected behavior
The seconds component of the Date should always be zero if showSeconds=false to avoid confusion
The text was updated successfully, but these errors were encountered: