今日已更新 44 条资讯 | 累计 42753 条内容
关于我们

Kairos 1.0 — a schedule language where "3 business days before month-end" is an expression

azathothx 2026年09月13日 23:57 3 次阅读 来源:Dev.to

Today I tagged 1.0 of Kairos , a schedule definition language I've been building — a small DSL where schedules like "3 business days before month-end" or "payday on the 25th, previous business day if it's a holiday" are single expressions. premise US { calendar-system: Gregorian; calendar: NYSE; tz: "America/New_York"; wkst: Sun } @US monthEnd |> roll(Preceding, on: bizDay) |> shift(-3, unit: bizDay) The itch cron can say "the 25th". It cannot say "the 25th, rolled back onto business days". Quartz has L and LW , but they don't compose and don't know about holidays. RRULE was designed as an exchange format, not an expression language. The root problem isn't a missing feature — their expressions don't compose . You can't take the dates one rule derives and feed them into the next rule. Kairos is built around closure: every expression maps a time stream to a time stream, so derived streams (substitute holidays, fiscal periods, lunisolar months) feed further definitions. Try it in your browser The reference implementation runs client-side; nothing leaves the page. Payday: the 25th → previous business day (US federal holidays) 3 business days before month-end Deriving the observed federal holidays from the statutory dates alone — July 4, 2026 lands on a Saturday; the expression yields July 3. No lookup table of observed dates anywhere. What's different from a date library Temporal, date-fns, dateutil are arithmetic over points and durations . Kairos is one layer up: it defines and governs sets of instants (streams). Calendars are user-defined. The Gregorian calendar itself is a transparent stdlib written in Kairos. Fiscal calendars (4-4-5 included), trading calendars, and the Japanese lunisolar calendar are ordinary definitions, not built-ins. Derivation rules — like the observed-holiday expression above, or Japan's substitute-holiday law — live in the definition, not in a pre-expanded table. A definition denotes a set of instants. Evaluation is a pure function — missed

本文内容来源于互联网,版权归原作者所有
查看原文