Skip to content
Open
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
8 changes: 8 additions & 0 deletions lib/icalendar/util/kv.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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
Expand Down