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: selecting a new year is not being reflected when transitioning to the month view. #7254

Closed
blan19 opened this issue Sep 25, 2024 · 3 comments · Fixed by #7257
Closed
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@blan19
Copy link

blan19 commented Sep 25, 2024

Describe the bug

#7252 PR is already merged, but noticed that there might be an additional scenario that requires a consideration.

In the original code:

const displayYear = props.numberOfMonths > 1 ? metaYear : currentYear;
origin.mov

In the merged code:

const displayYear = props.numberOfMonths > 1 ? metaYear : viewYear;
merged.mov

when selects a year in the calendar component's year view, it seems that this selection is not being reflected when transitioning to the month view.

thank you for your time and consideration xD

Reproducer

https://stackblitz.com/edit/vitejs-vite-zz2lsp

Reproducer is origin code base, and the latest master branch is required for checking.

System Information

System:
    OS: macOS 14.4
    CPU: (11) arm64 Apple M3 Pro
    Memory: 71.53 MB / 18.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.17.0 - /usr/local/bin/node
    npm: 10.8.2 - /usr/local/bin/npm
    pnpm: 9.10.0 - ~/Library/pnpm/pnpm
  Browsers:
    Chrome: 129.0.6668.70
    Safari: 17.4
  npmPackages:
    primereact: master branch
    react: ^18.3.1 => 18.3.1

Steps to reproduce the behavior

  1. select a year in the calendar.
  2. check if the year value has changed in the month view.

Expected behavior

selecting a new year is being reflected when transitioning to the month view.

@blan19 blan19 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Sep 25, 2024
@melloware
Copy link
Member

cc @KumJungMin

@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 Sep 25, 2024
@blan19
Copy link
Author

blan19 commented Sep 26, 2024

displayYearvariable, used in createTitleYearElement, is only utilized in createTitle and createMonthYearView, so it appears there are no additional side effects.

const displayYear = props.yearNavigator ? metaYear : currentYear;

while changing the condition in ternary operator rather than its return values allows all the listed test scenarios to pass, there might be a better approach than using props.yearNavigator as the condition.

@KumJungMin
Copy link
Contributor

Thank you for the report :) I'll make sure to have it fixed by tomorrow at the latest.

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.

3 participants