Skip to content

fix(journal): give the day panel and the Home board one day boundary - #1964

Merged
h4yfans merged 2 commits into
mainfrom
journal-day-boundary
Sep 2, 2026
Merged

fix(journal): give the day panel and the Home board one day boundary#1964
h4yfans merged 2 commits into
mainfrom
journal-day-boundary

Conversation

@h4yfans

@h4yfans h4yfans commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

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 shared localDayRange.

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 because search.ts filters with an inclusive to.

The remaining T00:00:00.000Z hits (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's threads pool where assigning process.env.TZ never reaches tzset. So alongside the child-node case that pins the reported instant in a real zone, local-day-range.test.ts now 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 — green
  • desktop renderer suite, full: 714 files / 8863 tests passing
  • pnpm lint — 0 errors
  • pnpm docs:impact --base d1ee526 --strict — covered; pnpm docs:build green
  • Mutation: reinstating the UTC pin in journal-day-panel.tsx fails the guard at TZ=UTC; same for search-filters.tsx. Reinstating it in the panel also fails the rendering tests at a non-UTC host zone.

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
@github-actions github-actions Bot added bug Something isn't working documentation Improvements or additions to documentation test labels Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 24eb0cf.

@h4yfans
h4yfans marked this pull request as ready for review September 2, 2026 17:20
@h4yfans
h4yfans merged commit 30195ac into main Sep 2, 2026
15 checks passed
@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Journal day panel pins its day range to UTC midnight, so it disagrees with the Home board

1 participant