ICalendar (ICalendar v1.1.3)

View Source

Generating ICalendars.

Summary

Functions

encode_to_iodata(calendar, options \\ [])

To create a Phoenix/Plug controller and view that output ics format:

Add to your config.exs:

config :phoenix, :format_encoders,
  ics: ICalendar

In your controller use:

calendar = %ICalendar{ events: events }
render(conn, "index.ics", calendar: calendar)

The important part here is .ics. This triggers the format_encoder.

In your view can put:

def render("index.ics", %{calendar: calendar}) do
  calendar
end

encode_to_iodata!(calendar, options \\ [])

from_ics(events)

See ICalendar.Deserialize.from_ics/1.

to_ics(events, options \\ [])

See ICalendar.Serialize.to_ics/2.