Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions App/Extensions/Foundation+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,15 @@ extension ISO8601DateFormatter {
}
}

// If the string already includes a timezone, don't guess with local-time parsing.
// If the string already includes a timezone suffix on a *time* component,
// don't guess with local-time parsing. We must NOT run this check on a
// bare `yyyy-MM-dd` because the trailing `-DD` would match the
// `[+-]\d{2}` branch of this regex and falsely classify the day as a
// timezone offset, causing the parser to bail before trying the
// `yyyy-MM-dd` fallback below.
let hasTimeZoneInfo =
dateString.range(
dateString.count > 10
&& dateString.range(
of: #"([Zz]|[+-]\d{2}(:?\d{2})?)$"#,
options: .regularExpression
) != nil
Expand Down
10 changes: 8 additions & 2 deletions App/Services/Calendar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,11 @@ final class CalendarService: Service {
events = events.filter { ($0.hasRecurrenceRules) == isRecurring }
}

return events.map { Event($0) }
return events.map { event -> Event in
var e = Event(event)
e.identifier = event.eventIdentifier
return e
}
}
Tool(
name: "events_create",
Expand Down Expand Up @@ -533,7 +537,9 @@ final class CalendarService: Service {
// Save the event
try self.eventStore.save(event, span: .thisEvent)

return Event(event)
var result = Event(event)
result.identifier = event.eventIdentifier
return result
}
}
}