View Source Naiveical.FreeBusy (Naiveical v1.0.0)

This module provides functions for extracting free/busy time information from iCalendar data.

It handles timezone conversions, duration calculations, and busy period extraction from VEVENT components.

Link to this section Summary

Functions

Extracts busy periods from an iCalendar event within a given time range.

Link to this section Functions

Link to this function

extract_busy_period_from_event(ical_data, time_range)

View Source
@spec extract_busy_period_from_event(String.t(), %{start: String.t(), end: String.t()}) ::
  [
    %{start: String.t(), end: String.t()}
  ]

Extracts busy periods from an iCalendar event within a given time range.

Returns a list of busy periods as maps with :start and :end keys in ISO 8601 basic format.

parameters

Parameters

  • ical_data - The iCalendar data as a string
  • time_range - A map with :start and :end keys in ISO 8601 basic format (e.g., "20251105T100000Z")

examples

Examples

iex> ical = "BEGIN:VEVENT\r\nDTSTART:20251105T100000Z\r\nDTEND:20251105T110000Z\r\nEND:VEVENT"
iex> time_range = %{start: "20251105T000000Z", end: "20251106T000000Z"}
iex> Naiveical.FreeBusy.extract_busy_period_from_event(ical, time_range)
[%{start: "20251105T100000Z", end: "20251105T110000Z"}]