Documentation
¶
Overview ¶
Package recurrence expands RFC 5545 rules through rrule-go (ADR-0008).
The dependency lives here and nowhere else. ADR-0008 chose it over a home-grown implementation - "DST and edge cases are a well-known source of bugs" - and arc42 §11 R-07 names the same risk; what this package does is keep that choice reversible: the port is ours, the library is behind it, and a second implementation would be a second file rather than a change to the core.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Expander ¶
type Expander struct{}
Expander is the adapter. It holds nothing: a rule is expanded from its text every time, because the text is what is stored and a cache would be a second copy of it that can disagree.
func (Expander) Occurrences ¶
func (e Expander) Occurrences( rule port.Rule, after, before time.Time, limit int, ) ([]time.Time, error)
Occurrences reads the rule in its own zone and answers the moments it produces.
The expansion runs on the **wall clock** and the zone is applied afterwards, one occurrence at a time. That is not a detail: it is what "DST is resolved through the stored time zone, not through UTC offsets" means once it is code (arc42 §6.3, i18n-l10n.md §4). A daily series at 09:00 is a series of 09:00s, and the instants between them are 23, 24 or 25 hours apart depending on what the zone did that night.
Expanding with a zoned start instead produces a failure this project cannot have, and this library does produce it: on a night when a zone springs forward at midnight (America/Sao_Paulo, 4 November 2018) the same local day comes back twice and the following one never appears at all. Expanding on the wall clock and mapping afterwards cannot do that - every reading appears exactly once, and the zone decides only which instant it is.
Two readings need a rule of their own, and both are the standard library's rather than this adapter's, which is why they are stated here and pinned by the golden files: a local time that does not exist (02:30 on a spring-forward night) moves forward by the gap, and one that exists twice (02:30 on a fall-back night) is the second of the two.