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: Inconsistent behaviour around viewDate and changed value. #3516

Closed
harrybradshaw opened this issue Oct 28, 2022 · 3 comments · Fixed by #3517
Closed

Calendar: Inconsistent behaviour around viewDate and changed value. #3516

harrybradshaw opened this issue Oct 28, 2022 · 3 comments · Fixed by #3517
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@harrybradshaw
Copy link
Contributor

Describe the bug

Depending on the order of

  1. Programmatically setting the date
  2. Opening the pop-out

Either the new date or the old date is shown.

Reproducer

https://codesandbox.io/s/focused-cloud-3w73if?file=/src/demo/CalendarDemo.js:1442-1452

PrimeReact version

8.6.0

React version

17.x

Language

ALL

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

  1. Open the popout. Observe page is for 'Oct 2022'.
  2. Click button to change date to '2023-11-01'.
  3. Reopen popout and and see page for 'Nov 2022' (Note: The year here is also incorrect! It correct if you click into the year selector however...)

Alternatively

  1. Immediately click button to change date to '2023-11-01'.
  2. Open popout, see page is still 'Oct 2022'.

Expected behavior

If have not opened out the popout previously then it should open at the value that the date is currently set to, not the one that was set when initialised.

Problem is relevant when a minDate has been set, as it then opens up at an invalid date. If using custom datePickers this is a poor experience.

@harrybradshaw harrybradshaw 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 28, 2022
@melloware
Copy link
Member

OK so there is definitely a bug but mine still says Oct 2022 not Nov 1 so I wonder if its browser timezone sensitive?

@harrybradshaw
Copy link
Contributor Author

Probably clearer to move the date away from the month crossover, have changed to the 3rd for clarity.

@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 28, 2022
@melloware melloware self-assigned this Oct 28, 2022
@melloware melloware added this to the 8.7.1 milestone Oct 28, 2022
@melloware
Copy link
Member

OK I submitted a PR that fixes both your issues

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