API Reference Tempo v#0.4.0

Copy Markdown View Source

Modules

Documentation for Tempo.

Exception raised when a wall-clock reading occurs twice in the given time zone — the DST fall-back ambiguity. The wall time exists, but with two different UTC offsets; the caller must disambiguate with an explicit offset.

A behaviour for providing the current time to Tempo.

Default implementation of Tempo.Clock using Erlang's system time via DateTime.utc_now/0.

A process-local deterministic clock for use in tests.

Shared comparison primitives for Tempo values.

Exception raised when a Tempo value cannot be converted to the requested target — typically a standard-library Date.t/0, Time.t/0, NaiveDateTime.t/0, or DateTime.t/0, or in the reverse direction an ISO 8601 or IXDTF encoding that the target type does not support.

Parser for cron expressions, producing the same Tempo.RRule.Rule.t/0 AST that the ISO 8601 / RFC 5545 RRULE parser produces.

Exception raised when a cron expression cannot be parsed or when one of its fields is outside the valid range for that cron field.

Exception raised when an IXDTF suffix contains more than one time-zone annotation. The standard permits at most one zone identifier per value.

A calendar-relative duration — a list of {unit, amount} pairs such as [year: 1, month: 6]. Produced by the ISO 8601 parser (P1Y6M), the RRULE encoder (as the FREQ + INTERVAL cadence), and arithmetic helpers in Tempo.Math.

Plain-English explanations of Tempo values, in a form renderers can style.

A structured explanation of a Tempo value.

Exception raised when an operation requires zone or offset information but the supplied Tempo value is floating — no [IANA/Zone] tag, no Z, no numeric offset.

Locale-aware formatting for Tempo values, dispatching to the Localize library.

Import iCalendar (RFC 5545) data into %Tempo.IntervalSet{}.

An explicit bounded span on the time line.

Exception raised when an operation requires an interval whose endpoints are both concrete %Tempo{} structs, but the supplied interval carries recurrence, duration-only, or otherwise non-concrete endpoints.

A sorted, non-overlapping, coalesced list of Tempo.Interval.t/0 values — the multi-interval counterpart to Tempo.Interval.

Exception raised when date components do not form a valid date under the chosen calendar.

Exception raised when time-of-day components do not form a valid time.

Exception raised when an unrecognised time-unit atom is passed to a function expecting one of :year, :month, :week, :day, :hour, :minute, :second, :day_of_year, or :day_of_week.

Tokenizes an ISO 8601 (parts 1 and 2) or IXDTF string into a list of tagged tokens that the internal parser then converts into a Tempo.t/0 struct.

Tokenizer combinators and post-processing for the Internet Extended Date/Time Format (IXDTF) defined in draft-ietf-sedate-datetime-extended-09.

Numbers aren't just numbers in ISO8601 when considering the extension formats. In some situations they may

The canonical list of positive leap seconds announced by the International Earth Rotation and Reference Systems Service (IERS) since the UTC–TAI framework began in 1972.

Exception raised when a value cannot be materialised into an explicit Tempo.Interval or Tempo.IntervalSet.

Time-unit arithmetic primitives used by enumeration, interval materialisation (Tempo.to_interval/1), and eventually Tempo + Duration / Tempo − Duration operations.

Exception raised when an operation requires a Tempo value anchored to the time line (that is, carrying at least a year component) but the caller supplied a non-anchored value.

Set operations on Tempo values — union, intersection, complement, difference, symmetric difference — plus the companion predicates (disjoint?/2, overlaps?/2, subset?/2, contains?/2, equal?/2).

Exception raised when an ISO 8601 or IXDTF string cannot be parsed.

Parses iCalendar RFC 5545 RRULE strings into Tempo AST (%Tempo.Interval{} with a %Tempo.Duration{} cadence and, where needed, a repeat_rule built from selection tokens).

Materialise an RFC 5545 RRULE into concrete occurrences by forming the right AST and handing it to Tempo's interpreter.

A canonical, typed representation of an RFC 5545 RRULE.

Resolve RRULE BY* selection tokens during recurrence expansion.

Exception raised when an RFC 5545 RRULE cannot be parsed, validated, or encoded. Reasons include a missing FREQ, mutually exclusive UNTIL/COUNT, and invalid BY-rule combinations.

A pair of Tempo values denoting a range, produced by the ISO 8601-2 range operator (2022..2024). The first and last bounds are inclusive — contrast with %Tempo.Interval{} which uses the half-open [from, to) convention.

Exception raised when a resolution operation cannot be performed — truncating to a finer unit than the current resolution, extending to a coarser unit, or following a unit-successor chain that terminates before the target under a particular calendar.

Exception raised when a rounding operation cannot be performed — typically because the target unit is not reachable from the value's current resolution under the active calendar.

Narrow a Tempo span by a selector — the composition primitive for "workdays of June", "the 15th of every month", "every Dec 25 in the next decade", and user-supplied holidays.

A Tempo-valued set — either all-of ({a, b, c} in ISO 8601-2, free/busy semantics) or one-of ([a, b, c], epistemic disjunction — "it was one of these, I don't know which").

Deprecated — use Tempo.Sigils (plural).

Sigils for constructing and pattern-matching %Tempo{} values at compile time.

Territory resolution — the bridge between the CLDR/BCP 47 territory world (:US, :SA, :GB) and Tempo's locale-dependent constructors (Tempo.workdays/1, Tempo.weekend/1, and future holiday helpers).

Exception raised when a caller attempts to materialise an unbounded recurrence (recurrence: :infinity with no UNTIL and no :bound option) into a concrete IntervalSet.

Exception raised when a time-zone identifier is not present in the loaded Tzdata database.

A web-based visualizer for ISO 8601 / ISO 8601-2 / IXDTF strings.

A helper that runs Tempo.Visualizer as a standalone web server for local exploration.

Exception raised when a wall-clock reading does not exist in the given time zone.