debianize-mobilizon/lib/mobilizon/export/icalendar.ex
Thomas Citharel 559c889f1b Rename project to Mobilizon
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2018-10-11 17:37:39 +02:00

24 lines
494 B
Elixir

defmodule Mobilizon.Export.ICalendar do
@moduledoc """
Export an event to iCalendar format
"""
alias Mobilizon.Events.Event
@spec export_event(%Event{}) :: String
def export_event(%Event{} = event) do
events = [
%ICalendar.Event{
summary: event.title,
dtstart: event.begins_on,
dtend: event.ends_on,
description: event.description,
uid: event.uuid
}
]
%ICalendar{events: events}
|> ICalendar.to_ics()
end
end