Journal: overnight ranges (23:00 - 01:00) lose their end time on any rewrite #99

Closed
opened 2026-09-25 16:28:38 +00:00 by kayg · 1 comment
Owner

Found by the log-drag job (#94). A Log line with a range that crosses midnight (e.g. '- 23:00 - 01:00 Night shift') is parsed as having no end time, so any rewrite of that line (move, resize, edit, CalDAV round trip) drops the end time and saves '- 23:00 Night shift'.

Fix: parse an end earlier than the start as next-day end (the entry belongs to the day it starts); keep it through every writer and the CalDAV projection (DTEND next day). Tests: parse, rewrite round trip, CalDAV round trip, calendar week view display across midnight.

Found by the log-drag job (#94). A Log line with a range that crosses midnight (e.g. '- 23:00 - 01:00 Night shift') is parsed as having no end time, so any rewrite of that line (move, resize, edit, CalDAV round trip) drops the end time and saves '- 23:00 Night shift'. Fix: parse an end earlier than the start as next-day end (the entry belongs to the day it starts); keep it through every writer and the CalDAV projection (DTEND next day). Tests: parse, rewrite round trip, CalDAV round trip, calendar week view display across midnight.
Author
Owner

Fixed on branch job/journal-cas (commit 3372130). It is not merged or deployed.

Root cause. read_time_prefix read an end that is earlier than the start, then dropped it: it returned "no end" and removed the text. So every rewrite saved - 23:00 Night shift.

Fix. An end that is earlier than the start is now a next-day end. The entry belongs to its start day (LogEntry::ends_next_day). It is kept through:

  • all Log line writers;
  • PATCH and "Log this", which no longer reject end < start;
  • CalDAV: DTEND is on the next day. A PUT with a next-day DTEND that is earlier than DTSTART parses back to the same line. 24 h or more is still refused;
  • "Log this" of a provider event that crosses midnight once;
  • the week view. It already drew the block to midnight. A drag or Alt+arrow move now keeps the real length, where it cut the end to 23:59 before.

Tests: parse, log_rewrite.rs (every writer, on the line and next to it), REST PATCH plus CalDAV round trip, a month and year boundary in the ICS round trip, web movedEnd/crossesMidnight, and calendar e2e step 6c (the block reaches midnight, and a drag keeps 21:00 → 00:00).

Fixed on branch `job/journal-cas` (commit 3372130). It is not merged or deployed. **Root cause.** `read_time_prefix` read an end that is earlier than the start, then dropped it: it returned "no end" and removed the text. So every rewrite saved `- 23:00 Night shift`. **Fix.** An end that is earlier than the start is now a next-day end. The entry belongs to its start day (`LogEntry::ends_next_day`). It is kept through: - all Log line writers; - PATCH and "Log this", which no longer reject end < start; - CalDAV: DTEND is on the next day. A PUT with a next-day DTEND that is earlier than DTSTART parses back to the same line. 24 h or more is still refused; - "Log this" of a provider event that crosses midnight once; - the week view. It already drew the block to midnight. A drag or Alt+arrow move now keeps the real length, where it cut the end to 23:59 before. **Tests:** parse, `log_rewrite.rs` (every writer, on the line and next to it), REST PATCH plus CalDAV round trip, a month and year boundary in the ICS round trip, web `movedEnd`/`crossesMidnight`, and calendar e2e step 6c (the block reaches midnight, and a drag keeps 21:00 → 00:00).
kayg closed this issue 2026-09-25 20:24:23 +00:00
kayg referenced this issue from a commit 2026-09-25 21:43:40 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal#99
No description provided.