debianize-mobilizon/lib/eventos/export/icalendar.ex
Thomas Citharel 63b63d9ee2
Encore des commits degeu
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2018-06-06 18:18:33 +02:00

21 lines
465 B
Elixir

defmodule Eventos.Export.ICalendar do
@moduledoc """
Export an event to iCalendar format
"""
alias Eventos.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