fix(journal): give the day panel and the Home board one day boundary - #1964
Merged
Conversation
The Journal day panel built its own window by pinning the local date to `T00:00:00.000Z`, the defect #1920 removed from the Home board. Once that landed the two surfaces disagreed by the host's UTC offset: at UTC-7 a 22:00 local event is 05:00Z the next day, so the panel filed it under tomorrow while Home filed it under today. The panel now calls the shared `localDayRange`. The sweep the issue asked for turned up a second caller. The search date presets read the day off `toISOString()` and covered the UTC day, so both the day they named and the window they spanned were UTC's: at UTC-7 a note edited at 18:00 local landed on tomorrow's date and fell outside "Today" entirely. They go through the same helper, backing a millisecond off the end because `search.ts` filters with an inclusive `to`. A behavioural test cannot separate the two windows on a UTC CI runner, which is where the old panel window and the correct one happen to agree — verified by mutation: reinstating either pin leaves the rendering tests green at TZ=UTC. So the regression gate is structural as well: `local-day-range.test.ts` now fails if any renderer module rebuilds a day window at UTC midnight. Closes #1954
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
h4yfans
marked this pull request as ready for review
September 2, 2026 17:20
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
The Journal day panel built its own day window by pinning the local date to
T00:00:00.000Z— the exact defect #1920 removed from the Home board. Once that PR landed, the two surfaces disagreed with each other by the host's UTC offset: at UTC-7 a 22:00 local event is 05:00Z the next day, so the panel filed it under tomorrow while Home filed it under today. The panel now calls the sharedlocalDayRange.The sweep #1954 asked for turned up a second caller. The search date presets read the day off
toISOString()and covered the UTC day, so both the day they named and the window they spanned were UTC's: at UTC-7 a note edited at 18:00 local landed on tomorrow's date and fell outside "Today" entirely. They go through the same helper now, backing one millisecond off the end becausesearch.tsfilters with an inclusiveto.The remaining
T00:00:00.000Zhits (journal streak counting,app-core/tasks.ts,journal-api.ts) are date-string arithmetic, not wall-clock windows — UTC is deliberate and correct there, so they are untouched.The tests needed a structural gate
A behavioural test cannot separate the two windows on a UTC CI runner, which is the one zone where the old window and the correct one agree. Verified by mutation: reinstating either pin leaves every rendering test green under
TZ=UTC, and the renderer project runs on vitest'sthreadspool where assigningprocess.env.TZnever reachestzset. So alongside the child-nodecase that pins the reported instant in a real zone,local-day-range.test.tsnow fails if any renderer module rebuilds a day window at UTC midnight. Both mutants die under that gate at UTC.Closes #1954
Release note
The Journal day panel and the search date filters now use your local day. A late-evening or just-after-midnight event lands on the day you would put it on, and the day panel no longer disagrees with the Home board about which day an event belongs to.
Test plan
pnpm typecheck— greenpnpm lint— 0 errorspnpm docs:impact --base d1ee526 --strict— covered;pnpm docs:buildgreenjournal-day-panel.tsxfails the guard atTZ=UTC; same forsearch-filters.tsx. Reinstating it in the panel also fails the rendering tests at a non-UTC host zone.