ICalendar (ICalendar v1.1.2) View Source

Generating ICalendars.

Link to this section Summary

Link to this section Functions

Link to this function

encode_to_iodata(calendar, options \\ [])

View Source

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
Link to this function

encode_to_iodata!(calendar, options \\ [])

View Source

See ICalendar.Deserialize.from_ics/1.

Link to this function

to_ics(events, options \\ [])

View Source

See ICalendar.Serialize.to_ics/2.