ExBooking. JSCalendar
(ExBooking v0.1.0)
View Source
JSCalendar busy-time normalization.
Callers pass decoded JSCalendar-shaped maps. This module maps supported
Event and Group objects into merged UTC busy intervals and rejects
floating times or recurrence data that require a full adapter.
Example
iex> event = %{
...> "@type" => "Event",
...> "start" => "2026-07-13T09:00:00",
...> "timeZone" => "Etc/UTC",
...> "duration" => "PT30M"
...> }
...>
...> {:ok, [busy]} = ExBooking.JSCalendar.busy_intervals(event)
...> busy.end_at
~U[2026-07-13 09:30:00Z]
Summary
Functions
Extracts busy intervals from a decoded JSCalendar Event or Group.
Types
@type object() :: map()
A decoded JSCalendar object.
Functions
@spec busy_intervals(object()) :: {:ok, [ExBooking.Interval.t()]} | {:error, term()}
Extracts busy intervals from a decoded JSCalendar Event or Group.
Supported events require @type: "Event", start, timeZone, and optional
duration (default PT0S). freeBusyStatus: "free" and
status: "cancelled" events are ignored. Group.entries is a list of
objects.
Example
iex> event = %{
...> "@type" => "Event",
...> "start" => "2026-07-13T09:00:00",
...> "timeZone" => "Etc/UTC",
...> "duration" => "PT30M"
...> }
...>
...> {:ok, [busy]} = ExBooking.JSCalendar.busy_intervals(event)
...> busy.end_at
~U[2026-07-13 09:30:00Z]