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: When stepMinute is set, the time value does not "snap" on initial date change #5027

Closed
VytautasLozickas opened this issue Oct 4, 2023 · 0 comments · Fixed by #5032
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@VytautasLozickas
Copy link
Contributor

VytautasLozickas commented Oct 4, 2023

Describe the bug

Using the Calendar component and setting the stepMinute prop (together with showTime) does not behave as expected when setting the initial value. If the initial value is null|undefined and the date on the Calendar picker is selected (without "touching" the time controls) - the time on the actual date value is not snapped to the next n-th minute but it's rather always the current time.

The date picker's time controls are correctly "snapped" to the next n-th minute though.

This also leads to a weird behavior: the up or down buttons on the time picker UI must be clicked twice to change the time.

Reproducer

https://stackblitz.com/edit/react-8t4ps2-xsg1cm

PrimeReact version

10.0.2

React version

18.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

  1. Place the Calendar component on the page;
  2. Set the showTime prop to true;
  3. Set the stepMinute prop to some value (like 15);
  4. Select a date in the UI but don't modify the time;
  5. Observe the time value on the date input to be set to the current time even though the stepMinute prop is set to 15 so the expectation is for the time to "snap" to the next 15th minute.

Expected behavior

Time should "snap" to the next n-th minute which is set via stepMinute prop at the very moment the date is selected.

@VytautasLozickas VytautasLozickas added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Oct 4, 2023
@VytautasLozickas VytautasLozickas changed the title Calendar: When stepMinute is set, the value does not "snap" on initial date change Calendar: When stepMinute is set, the time value does not "snap" on initial date change Oct 4, 2023
melloware added a commit to melloware/primereact that referenced this issue Oct 4, 2023
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Oct 4, 2023
@melloware melloware added this to the 10.0.3 milestone Oct 4, 2023
@melloware melloware self-assigned this Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants