Skip to content

fix: iCal DTEND rolls to the next day for midnight-straddling sets#626

Merged
BreakableHoodie merged 1 commit into
mainfrom
fix/601-ical-midnight
Jul 17, 2026
Merged

fix: iCal DTEND rolls to the next day for midnight-straddling sets#626
BreakableHoodie merged 1 commit into
mainfrom
fix/601-ical-midnight

Conversation

@BreakableHoodie

Copy link
Copy Markdown
Owner

Summary

generateICal() stamped DTSTART and DTEND with the same calendar date, so a set straddling midnight (e.g. 23:30–00:30) emitted DTEND before DTSTART — an invalid VEVENT that calendar clients may reject or render with garbage duration (#601, found during #600 review). When end_time < start_time (zero-padded HH:MM compares lexicographically), DTEND now stamps the next calendar day via a DST-proof UTC date helper — the exact mirror of prepareBands()'s endMs < startMs roll on the frontend. Pure after-midnight sets (starts 00:00–05:59) are untouched: both stamps correctly share the stored date, and the existing test pinning that behaviour still passes.

Closes #601

What changed

File Change
functions/api/feeds/ical.js endDate rolls +1 day when endTime < startTime (rationale + after-midnight distinction commented); nextCalendarDay() helper (UTC math on the date literal)
functions/api/feeds/__tests__/ical.test.js #601 describe: 23:30–00:30 → DTEND next day (and NOT same-day); month boundary 03-31 → 04-01

Security / correctness notes

None — public read-only feed; only the DTEND date component changes, and only for straddling sets.

Verification

  • Tests: backend 757 pass | 6 todo (74 files); ical suite 16/16 (14 + 2 new)
  • ESLint: 0 errors
  • Format check: clean
  • Build: n/a — backend-only
  • validate:openapi: n/a — feed route, response shape unchanged
  • Manual smoke: covered by real-DB tests asserting exact DTSTART/DTEND stamps

Built by Theo · Reviewed by Theo · 🤖 Claude Code

A set crossing midnight (23:30-00:30) stamped DTEND with the same
calendar date as DTSTART, producing an invalid VEVENT (end before
start) that calendar clients may reject. When end_time < start_time
(zero-padded HH:MM compares lexicographically), DTEND now stamps the
following day — mirroring prepareBands()'s endMs < startMs roll.
Pure after-midnight sets (00:00-05:59 starts) are unaffected.

Closes #601

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@BreakableHoodie BreakableHoodie added the bug Something isn't working label Jul 17, 2026
Copilot AI review requested due to automatic review settings July 17, 2026 15:58
@BreakableHoodie BreakableHoodie added priority:p3 Lower priority bug Something isn't working labels Jul 17, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@BreakableHoodie
BreakableHoodie merged commit 0768c84 into main Jul 17, 2026
21 checks passed
@BreakableHoodie
BreakableHoodie deleted the fix/601-ical-midnight branch July 17, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working priority:p3 Lower priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iCal: sets crossing midnight emit DTEND before DTSTART (invalid VEVENT)

2 participants