From 1df07ea70ca2d5b9ec4798d1821f12f55ecab0ed Mon Sep 17 00:00:00 2001 From: Craig Savolainen Date: Wed, 26 Jun 2024 16:21:26 -0400 Subject: [PATCH] Force organizer field to use semi-colon field separator gmail refuses to parse the field otherwise Wikipedia also explicitly has a semi-colon in the example https://en.wikipedia.org/wiki/ICalendar#Design --- lib/icalendar/util/kv.ex | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/icalendar/util/kv.ex b/lib/icalendar/util/kv.ex index 81abb41..e423b6b 100644 --- a/lib/icalendar/util/kv.ex +++ b/lib/icalendar/util/kv.ex @@ -16,6 +16,10 @@ defmodule ICalendar.Util.KV do iex> ICalendar.Util.KV.build("foo", nil) "" + Organizer uses semi-colon field separator: + iex> ICalendar.Util.KV.build("ORGANIZER", "CN=John Smith:mailto:johnsmith@example.com") + "ORGANIZER;CN=John Smith:mailto:johnsmith@example.com\n" + DateTime values will add timezones: iex> date = @@ -106,6 +110,10 @@ defmodule ICalendar.Util.KV do |> Enum.join("") end + def build("ORGANIZER", value) do + "ORGANIZER;#{Value.to_ics(value)}\n" + end + def build(key, date = %DateTime{time_zone: "Etc/UTC"}) do "#{key}:#{Value.to_ics(date)}Z\n" end