Server-side calendar link and ICS generation for Phoenix LiveView apps.
Generates calendar provider URLs and downloadable .ics files from plain
Elixir Date / Time structs — no JavaScript dependency, no timezone
database required.
Quick start
event = %AddToCalendar.Event{
name: "Pickleball League",
start_date: ~D[2026-07-15],
start_time: ~T[09:00:00],
end_date: ~D[2026-07-15],
end_time: ~T[11:00:00],
timezone: "Pacific/Auckland",
location: "123 Main St, Auckland",
description: "Weekly round-robin"
}
AddToCalendar.google_url(event)
# => "https://calendar.google.com/calendar/render?..."
AddToCalendar.ics_content(event)
# => "BEGIN:VCALENDAR\r\n..."Phoenix component
See AddToCalendar.Component.calendar_button/1 for a ready-made dropdown
component (requires phoenix_live_view).
Summary
Functions
Returns the Google Calendar URL for the event.
Returns the RFC 5545 iCalendar (.ics) content for the event.
Returns a data:text/calendar;base64,... URI suitable for an <a download> link.
Returns a filename for the .ics download (slugified event name).
Returns the Outlook.com calendar URL for the event.
Functions
@spec google_url(AddToCalendar.Event.t()) :: String.t()
Returns the Google Calendar URL for the event.
@spec ics_content(AddToCalendar.Event.t()) :: String.t()
Returns the RFC 5545 iCalendar (.ics) content for the event.
@spec ics_data_uri(AddToCalendar.Event.t()) :: String.t()
Returns a data:text/calendar;base64,... URI suitable for an <a download> link.
@spec ics_filename(AddToCalendar.Event.t()) :: String.t()
Returns a filename for the .ics download (slugified event name).
@spec outlook_url(AddToCalendar.Event.t()) :: String.t()
Returns the Outlook.com calendar URL for the event.