fix: honor calendarStartDay when navigating with the End key - #6327
Open
balajis-qb wants to merge 1 commit into
Open
balajis-qb wants to merge 1 commit into
balajis-qb wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6327 +/- ##
==========================================
+ Coverage 99.29% 99.32% +0.02%
==========================================
Files 30 30
Lines 3822 3826 +4
Branches 1648 1651 +3
==========================================
+ Hits 3795 3800 +5
+ Misses 26 25 -1
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The Home keyboard handler passed `locale` and `calendarStartDay` to
`getStartOfWeek`, but the End handler called `getEndOfWeek(date)` with no
configuration. With a non-Sunday week start (e.g. `calendarStartDay={1}`),
End moved focus to Saturday instead of the configured last day (Sunday).
`getEndOfWeek` now accepts optional `locale` and `calendarStartDay`
arguments, mirroring `getStartOfWeek`, and the End handler forwards both so
Home and End compute symmetric week boundaries.
Fixes Hacker0x01#6326
balajis-qb
force-pushed
the
fix/6326-end-key-calendar-start-day
branch
from
September 8, 2026 10:26
be5f7ea to
9c4bba5
Compare
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.
Summary
Fixes #6326.
Problem
The calendar lets you jump to the first day of the week with the
Homekey and to the last day of the week with theEndkey. When weeks are configured to start on a day other than Sunday (for examplecalendarStartDay={1}for a Monday–Sunday week),Homerespected that setting butEnddid not.The cause: the
Homehandler passedlocaleandcalendarStartDaytogetStartOfWeek, but theEndhandler calledgetEndOfWeek(date)with no configuration, sodate-fnsfell back to its own default of a Sunday–Saturday week.Example — with
calendarStartDay={1}, focus on Wednesday, June 12, 2024:HomeEndThe keyboard handler before the fix:
Changes
src/date_utils.ts:getEndOfWeeknow accepts optionallocaleandcalendarStartDayarguments, mirroringgetStartOfWeek, and forwards them todate-fnsendOfWeekvia{ locale, weekStartsOn }.src/index.tsx: theEndcase in the keyboard handler now callsgetEndOfWeek(date, locale, calendarStartDay), soHomeandEndcompute symmetric week boundaries.src/test/date_utils_test.test.ts: newgetEndOfWeektests — default Sunday–Saturday week, Monday–Sunday week viacalendarStartDay, and symmetry withgetStartOfWeek.src/test/datepicker_test.test.tsx: new test assertingEndmoves focus to Sunday, June 16, 2024 withcalendarStartDay={1}.The new parameters are optional, so existing single-argument callers and tests are unaffected.
yarn test:ci(43 suites, 1489 tests),yarn type-check, andyarn eslintall pass.Contribution checklist