Skip to content

fix: include final constrained year in CalendarYearPicker - #10536

Open
ZedingZhang wants to merge 1 commit into
adobe:mainfrom
ZedingZhang:fix/calendar-year-picker-final-year
Open

fix: include final constrained year in CalendarYearPicker#10536
ZedingZhang wants to merge 1 commit into
adobe:mainfrom
ZedingZhang:fix/calendar-year-picker-final-year

Conversation

@ZedingZhang

@ZedingZhang ZedingZhang commented Aug 30, 2026

Copy link
Copy Markdown

Closes #10531

When both minValue and maxValue are set, the year picker steps forward from the exact month and day in minValue. If the month and day in the final year fall after maxValue, 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:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (unit coverage added; no storybook change is needed for this logic fix).
  • Filled out test instructions.
  • Updated documentation (no documentation change is needed because the public API and intended behavior are unchanged).
  • Looked at the Accessibility Practices for this feature - Aria Practices (the existing select interaction and semantics are unchanged).
  • I understand every change in this PR and can explain why it's there.
  • If AI-assisted, I followed our AI contribution guidance and pointed my assistant at CLAUDE.md.

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:

  1. Render a Calendar with minValue={new CalendarDate(2024, 8, 3)}, maxValue={new CalendarDate(2025, 2, 3)}, and focusedValue={new CalendarDate(2025, 2, 1)}.
  2. Open the CalendarYearPicker.
  3. Verify that the options are 2024 and 2025, and that 2025 is selected.
  4. Select 2025 and verify that focus remains within the allowed range rather than moving to August 3, 2025.

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.
  • Constraints, package lint, TypeScript checks, oxlint, targeted formatting, and git diff --check passed.
  • The full Jest run was also attempted. The changed Calendar suite passed; unrelated existing Windows failures remained in locale fixture resolution, path separator assertions, and codemod temporary-directory handling.
  • The repository-wide format check reports CRLF differences across 6481 untouched files in this Windows checkout; both changed files pass oxfmt --check.

Your Project:

Personal contribution.

@ZedingZhang ZedingZhang reopened this Aug 31, 2026
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.

CalendarYearPicker omits the final year when both minValue and maxValue are set

1 participant