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

fix: show viewDate year when yearNavigator mode #7252

Merged
merged 2 commits into from
Sep 25, 2024

Conversation

KumJungMin
Copy link
Contributor

@KumJungMin KumJungMin commented Sep 25, 2024

Defect Fixes

how to resolve

  • When using yearNavigator mode, changing the year in the select input doesn't update the displayed year.
  • This happens because the select input is showing the currentYear instead of the year selected by the user.
  • Therefore, I changed it to display viewYear instead of currentYear to ensure that the select input reflects the year selected by the user.
// before
const createTitleYearElement = (metaYear) => {
    const viewDate = getViewDate();
    const viewYear = viewDate.getFullYear();
    const displayYear = props.numberOfMonths > 1 ? metaYear : currentYear; // here!
    ...
// after
const createTitleYearElement = (metaYear) => {
    const viewDate = getViewDate();
    const viewYear = viewDate.getFullYear();
    const displayYear = props.numberOfMonths > 1 ? metaYear : viewYear; // here!
    ...

test

  • First, I verified that the issue has been resolved.
resolved.mov

related issue: Incorrect year with numberOfMonths and yearNavigator

previous.issue.resolve.mov

Copy link

vercel bot commented Sep 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
primereact ⬜️ Ignored (Inspect) Visit Preview Sep 25, 2024 0:04am
primereact-v9 ⬜️ Ignored (Inspect) Visit Preview Sep 25, 2024 0:04am

@melloware
Copy link
Member

@KumJungMin can you test this scenario: #6285 That is why it was using currentYear so I think we need to make it smart based on single mode or multiple month mode?

Copy link
Member

@melloware melloware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment

@KumJungMin
Copy link
Contributor Author

KumJungMin commented Sep 25, 2024

@melloware oh! I tested for the issues you mentioned,
I was writing test information in a draft PR document.
Could you please check again? :)

@KumJungMin KumJungMin marked this pull request as ready for review September 25, 2024 12:03
@melloware
Copy link
Member

OK awesome!

@melloware melloware merged commit e23e534 into primefaces:master Sep 25, 2024
5 checks passed
@KumJungMin KumJungMin deleted the fix/issue-7234 branch September 25, 2024 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calendar: The yearNavigator does not update the displayed year after selecting a new year.
2 participants