Skip to content

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

Description

@BreakableHoodie

Found while reviewing #600 (day-aware iCal, part of #542). Pre-existing, not introduced there.

In functions/api/feeds/ical.js generateICal(), DTSTART and DTEND both use the same calendar date:

const dtstart = `${eventDate.replace(/-/g, "")}T${startTime.replace(/:/g, "")}00`;
const dtend = `${eventDate.replace(/-/g, "")}T${endTime.replace(/:/g, "")}00`;

A set that crosses midnight (e.g. 23:3000:30) gets DTEND before DTSTART on the same date — an invalid VEVENT that calendar clients may reject or render with garbage duration. The frontend already handles this in prepareBands() (if (endMs < startMs) endMs += MS_PER_DAY); the iCal generator needs the same rule: when endTime < startTime (string compare works for zero-padded HH:MM), stamp DTEND with eventDate + 1 day.

Note this is distinct from after-midnight sets (start 00:00–05:59), which are fine — both stamps share the stored date. Only sets straddling midnight are affected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:p3Lower priority

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions