From 8238ac45ddf42bb088933795f959b74ec49211fc Mon Sep 17 00:00:00 2001 From: Nicole Bonfatti Date: Tue, 10 Mar 2026 10:00:10 -0400 Subject: [PATCH] Output date format consistent with input Updated the localDateFormatter to an ISO8601DateFormatter and set options to match expected input. --- Sources/EventKitManager.swift | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Sources/EventKitManager.swift b/Sources/EventKitManager.swift index 4ecc757..488a1ad 100644 --- a/Sources/EventKitManager.swift +++ b/Sources/EventKitManager.swift @@ -331,10 +331,18 @@ class EventKitManager { // MARK: - Helper Methods /// Creates a date formatter that outputs ISO 8601 format in the user's local timezone - private func localDateFormatter() -> DateFormatter { - let formatter = DateFormatter() - formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssXXXXX" // ISO 8601 with timezone offset - formatter.timeZone = TimeZone.current + private func localDateFormatter() -> ISO8601DateFormatter { + let formatter = ISO8601DateFormatter() + formatter.timeZone = .current + + formatter.formatOptions = [ + .withFullDate, + .withTime, + .withColonSeparatorInTime, + .withTimeZone // Z or ±HHMM + // NOTE: intentionally NOT including .withColonSeparatorInTimeZone or .withInternetDateTime + ] + return formatter }