Year-based navigation for arrows and Today - #2
Merged
Conversation
The < / > arrows previously shifted the current start/end window by a year with addYears, so any non-calendar-year view (e.g. after using the date-range picker) stayed >12 months and just slid sideways. Now the arrows navigate to year ± 1 (always a clean Jan..Dec view via the `year` param), and "Today" goes to the current calendar year (scrolling to today if already on it). The custom date-range picker still allows arbitrary multi-month ranges. Extracted resolveRange/yearRange into src/lib/calendar-range.ts (used by page.tsx) with tests; removed dead imports (getYearRangeDates, redirect, unused date-fns). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
The
</>arrows shifted the current start/end window by a year (addYears), so any non-calendar-year view (e.g. after the date-range picker) stayed >12 months and slid sideways instead of snapping to a year.Change
</>→ navigate to year ± 1, always a clean Jan..Dec (12 months) via theyearparam.resolveRange/yearRangetosrc/lib/calendar-range.ts(used bypage.tsx) with tests; removed dead imports.Verification
npm test→ 69 passing (incl. new calendar-range tests + the "arrow stays 12 months" invariant)npm run build→ green🤖 Generated with Claude Code