Kantoor. Dav. Ical
(Kantoor v1.0.0)
Small helpers for reading and editing iCalendar documents with the Dav
library's structural parser (Dav.Cal.ICalendar). Edits keep every property
they do not touch, so a task or event made on a phone survives a round trip
through the web UI (alarms, X- properties, attendees' answers...).
Times are handled as wall-clock values: {:date, Date} or
{:naive, NaiveDateTime, zone} with zone one of :floating, :utc or
{:tzid, name}. The zone is only remembered so a rewritten property keeps it.
Summary
Functions
A new calendar wrapping one component.
The first component named name without a RECURRENCE-ID (else the first).
Removes every property named name.
Encodes a moment as {value, parameters} for a property.
A mailto: calendar user address for a bare address.
Reads a date or date-time property as a wall-clock moment.
A fresh UID.
Parses a document, :error when it is not iCalendar.
A property, or nil.
Every property named name.
Replaces (or adds) the single property name; nil value removes it.
Replaces the first component named name of a calendar with component.
The events of a calendar grouped by UID, in the order they first appear: a list
of {uid, calendar}, each calendar holding only that UID's events (a series and
its overrides stay together) and every VTIMEZONE. An event with no UID is a
group of its own with nil. At most max groups are returned; skipped counts
the events left out.
The date part of a moment.
The wall-clock NaiveDateTime of a moment (midnight for a date).
The UTC timestamp format used by DTSTAMP, COMPLETED and LAST-MODIFIED.
A property's value, or nil when absent or empty.
Writes a calendar to iCalendar text.
Types
@type moment() :: {:date, Date.t()} | {:naive, NaiveDateTime.t(), zone()}
@type zone() :: :floating | :utc | {:tzid, String.t()}
Functions
A new calendar wrapping one component.
The first component named name without a RECURRENCE-ID (else the first).
Removes every property named name.
Encodes a moment as {value, parameters} for a property.
A mailto: calendar user address for a bare address.
Reads a date or date-time property as a wall-clock moment.
A fresh UID.
Parses a document, :error when it is not iCalendar.
Works around a bug in the DAV library's TEXT unescaping: it leaves \; in
values (its "\;" replacement is a no-op), so a parse-edit-write round trip
doubles backslashes before semicolons. Detected at runtime, so it switches
itself off once the library is fixed.
A property, or nil.
Every property named name.
Replaces (or adds) the single property name; nil value removes it.
Replaces the first component named name of a calendar with component.
@spec split_events(map(), pos_integer()) :: {[{String.t() | nil, map()}], non_neg_integer()}
The events of a calendar grouped by UID, in the order they first appear: a list
of {uid, calendar}, each calendar holding only that UID's events (a series and
its overrides stay together) and every VTIMEZONE. An event with no UID is a
group of its own with nil. At most max groups are returned; skipped counts
the events left out.
RFC 5546 allows several events in one iTIP message only when they share a UID
(section 3.2.2, REQUEST), so a message holding different UIDs is several
invitations in one envelope; each is handled alone.
The date part of a moment.
@spec to_naive(moment() | nil) :: NaiveDateTime.t() | nil
The wall-clock NaiveDateTime of a moment (midnight for a date).
@spec utc_stamp(DateTime.t()) :: String.t()
The UTC timestamp format used by DTSTAMP, COMPLETED and LAST-MODIFIED.
A property's value, or nil when absent or empty.
Writes a calendar to iCalendar text.