Klepsydra a temporal expression language

Named after the Greek water clock. Famously bad at its one job.

For source and tests, see ~arrdem/source/projects/klepsydra.

Expression Evaluator

DSL Reference

Operators

every monday                          # recurring schedule
every monday, wednesday, friday       # comma-separated union
mondays                               # plural = every monday
3rd tuesday of month                  # nth occurrence in scope
last friday of december               # last of scope
march through november                # contiguous range (wraps)
(A) during (B)                        # events from A within B
(A) except (B)                        # events from A not in B
(A) union (B)                         # merge both
(A) and (B)                           # intersection
first sunday after (every equinox)    # relative positioning
2nd friday before (christmas)         # relative backward
next tuesday                          # sugar: 1st after now
last full_moon                        # sugar: 1st before now
in 3 weeks                            # duration from now
every tuesday at 10:00am              # pin to time of day
every monday at 0900h US/Pacific      # military time + tz
let name be expr                      # bind a name
using hijri                            # set calendar scope
# this is a comment                   # line comments

Calendar Vocabulary

gregorian    january..december, monday..sunday
julian       same month/weekday names
hijri        muharram, safar, ..., ramadan, ..., dhul_hijjah
hebrew       tishrei, cheshvan, ..., elul
persian      farvardin..esfand, nowruz
bahai        baha, jalal, ..., ala, ayyam_i_ha, naw_ruz
coptic       thout, paopi, ..., mesori, nasie
bengali      baishakh, joishtho, ..., choitro
republican   vendemiaire, ..., fructidor, sansculottides
discordian   chaos, discord, confusion, bureaucracy, the_aftermath
darian       sagittarius..vrishchika (months), solis..saturni (sols)
tropical     aries..pisces (tropical zodiac signs)
sidereal     aries..pisces (sidereal zodiac signs)
iau          aries..pisces + ophiuchus (13 constellations)
solar_terms  lichun, yushui, ..., dahan (24 jieqi)
saura        mesha, vrishabha, ..., mina (Hindu solar months)
nakshatra    ashvini, bharani, ..., revati (27 lunar mansions)

Astronomical Events

full_moon / full_moons       new_moon / new_moons
first_quarter_moon           last_quarter_moon
equinox / equinoxes          solstice / solstices
vernal_equinox               autumnal_equinox
summer_solstice              winter_solstice
solar_eclipse / solar_eclipses
lunar_eclipse / lunar_eclipses
aries_season .. pisces_season
Feed Configuration (TOML)
[feed]
name = "Street Sweeping"

[[events]]
when = "(3rd tuesday of month) during (march through november)"
title = "Street Sweeping - {when:%A %B %d}"
description = "Move your car by 8am"
location = "Garage side of street"
categories = ["chores", "city"]
transparent = true
alarm = "-15m"

[[events]]
when = "every friday at 17:00"
title = "Happy Hour"
url = "https://example.com"

Supported fields: when, title, description, location, url, categories, transparent, alarm (-15m, -1h, -1d). Title and description support {when:FORMAT} placeholders.