mobilizon.chapril.org-mobil.../lib/eventos/export/icalendar.ex
Thomas Citharel 979aad5acb Remove credo and use mix format, and lint everything
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2018-07-27 10:45:35 +02:00

24 lines
490 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