fix: include final constrained year in CalendarYearPicker - #10536
Open
ZedingZhang wants to merge 1 commit into
Open
fix: include final constrained year in CalendarYearPicker#10536ZedingZhang wants to merge 1 commit into
ZedingZhang wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10531
When both
minValueandmaxValueare set, the year picker steps forward from the exact month and day inminValue. If the month and day in the final year fall aftermaxValue, that step overshoots the range and omits a year that still contains selectable dates.This includes the final overlapping calendar year and clamps its item date to
maxValue, so selecting the option cannot focus a date outside the allowed range. The regression test covers a range from August 3, 2024 through February 3, 2025 and verifies that 2025 is present, selected for a focused date in 2025, and backed by the clamped February 3 date.Pull Request Checklist:
AI assistance disclosure: I used OpenAI Codex to investigate the root cause, implement the change, and run validation. I reviewed and understand the resulting code and test.
Test Instructions:
CalendarwithminValue={new CalendarDate(2024, 8, 3)},maxValue={new CalendarDate(2025, 2, 3)}, andfocusedValue={new CalendarDate(2025, 2, 1)}.CalendarYearPicker.Automated validation:
yarn test packages/react-aria-components/test/Calendar.test.js --runInBand— 37 tests passed.yarn test:ssr --runInBand— 60 suites and 74 tests passed.git diff --checkpassed.oxfmt --check.Your Project:
Personal contribution.