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 sets seconds to current seconds even if showSeconds=false #14626

Closed
SkoZombie opened this issue Jan 25, 2024 · 2 comments
Closed
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@SkoZombie
Copy link

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

  1. Create a calendar [showTime]="true" [showSeconds]="false"
  2. Select a date and time
  3. Inspect the bound object, seconds will be set to whatever the current seconds rather than zero

Expected behavior

The seconds component of the Date should always be zero if showSeconds=false to avoid confusion

@SkoZombie SkoZombie 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 25, 2024
@uebelmar
Copy link
Contributor

documentation says "Whether to show the seconds in time picker"

so this option toggles only the display of the seconds in the picker. it does not manipulate the date object behind.

@mehmetcetin01140
Copy link
Contributor

Hi,

So sorry for the delayed response! Improvements have been made to many components recently, both in terms of performance and enhancement. Therefore, this improvement may have been developed in another issue ticket without realizing it. You can check this in the documentation. If there is no improvement on this, can you open a new issue so we can include it in our roadmap?

Thanks a lot for your understanding!
Best Regards,

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

3 participants