fix(search): date all-day results in UTC, like every other view (#82)
All checks were successful
Translations / check (pull_request) Successful in 6s
CI / ci (pull_request) Successful in 10m32s

Search formatted a result's date with ZoneId.systemDefault(), while the
month, week, day, agenda and detail surfaces all resolve an all-day event's
dates in UTC. All-day events are stored at UTC midnight with an exclusive
end, so west of UTC that difference is a whole day: an event on the 19th
came back from search dated the 18th, contradicting the grid it was filed
in. East of UTC the offset happens to land on the same date, which is why
this went unnoticed.

The rule was already written down twice — once as a private helper in
AgendaUiState, once inline in coversDay and formatWhen — so rather than
adding a third copy, dateZone/spanFirstDay/spanLastDay/spansMultipleDays
move into domain/Models.kt, where they are pure date logic rather than
agenda UI state, and search reads its date through spanFirstDay. The clock
time stays in the device zone; it is only ever rendered for timed events.

Covered by EventInstanceSpanTest, which pins both directions: the west-of-
UTC case from this issue and the east-of-UTC leak from #65.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-26 18:48:48 +02:00
parent bf6415c023
commit 7c94425e41
6 changed files with 143 additions and 31 deletions

View File

@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
- Search results now show an all-day event's real date. West of UTC — anywhere in
the Americas, say — a search hit was dated one day early, disagreeing with the
day the month, week and agenda views file the same event under ([#82]).
- Reminders now arrive for every calendar you have switched on. A calendar that
was hidden at system level — switched off in another calendar app, or never
switched on after being added — still showed its events and listed their
@@ -1135,3 +1138,4 @@ automatically, with zero telemetry and no internet permission.
[#44]: https://codeberg.org/jlmakiola/calendula/issues/44
[#70]: https://codeberg.org/jlmakiola/calendula/issues/70
[#75]: https://codeberg.org/jlmakiola/calendula/issues/75
[#82]: https://codeberg.org/jlmakiola/calendula/issues/82