From 465c465af2c1acbcc608ad515132f25d1962f27e Mon Sep 17 00:00:00 2001 From: Scarriffle Date: Sat, 12 Sep 2026 14:49:57 +0200 Subject: [PATCH] Treat a whole-day span as all-day, whatever the payload claims The previous rule only caught date-only strings. A multi-day event sent with full timestamps and no allDay flag still arrived as a timed event, so a holiday running from the 16th to the 21st rendered as a one-hour slot at midnight. Now an event that starts and ends on a day boundary and covers at least one whole day is all-day regardless. That is a statement about what the data means, not about how any one client formats it, which is why it lives in the parser and not in a view. Co-Authored-By: Claude Opus 5 --- Calendarr iOS/Models/CalEvent.swift | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Calendarr iOS/Models/CalEvent.swift b/Calendarr iOS/Models/CalEvent.swift index b5338d3..59c5cc0 100644 --- a/Calendarr iOS/Models/CalEvent.swift +++ b/Calendarr iOS/Models/CalEvent.swift @@ -98,11 +98,21 @@ struct CalEvent: Identifiable, Hashable { let clean = startStr.trimmingCharacters(in: .whitespaces) return clean.count == 10 && !clean.contains("T") }() - let isAllDay = (json["allDay"] as? Bool ?? false) || startIsDateOnly - let startDate = parseDate(startStr, allDay: isAllDay) - let endDate = parseDate(endStr, allDay: isAllDay) + let declaredAllDay = (json["allDay"] as? Bool ?? false) || startIsDateOnly + let startDate = parseDate(startStr, allDay: declaredAllDay) + let endDate = parseDate(endStr, allDay: declaredAllDay) guard let s = startDate, let e = endDate else { return nil } + // An event running midnight to midnight across one or more whole days + // is all-day whatever the payload claims. Without this, a six-day + // holiday sent without the flag renders as "00:00 – 00:00" — a time + // range that is technically true and tells the reader nothing. + let cal = Calendar.current + let spansWholeDays = e > s + && cal.startOfDay(for: s) == s + && cal.startOfDay(for: e) == e + let isAllDay = declaredAllDay || spansWholeDays + return CalEvent( id: id, url: json["url"] as? String ?? "",