The validating malli schemas for the time core's value objects.
Every schema here is CLOSED and validating, never shape-only: [:and [:map {:closed true} ...] [:fn pred?]] -- the closed map pins the shape (no stray keys) and the predicate pins the invariant, so a map that LOOKS right but is not a real Day (2026-02-31, year 1) fails. Consumers (reitit, the facade, calendario's wire layer) validate against these; the library itself does not depend on them.
Reuse, never duplicate: the Zone and Local schemas are the ones zone.cljc already defined and exports, and the closed sets (:enum) are the ones error.cljc (Reason) and age.cljc (policies) already defined. Only Day, Month, TimeOfDay and Period are NEW here, built on the predicates the earlier steps exported (day?, month?, time-of-day?, period?).
An Instant is NOT a value object: it is epoch milliseconds, a long. So there is no Instant schema; the instant CODEC (parse-instant / format-instant) is in instant.cljc.
Closed sets are malli :enum, never hive-dsl defadt: hive-dsl 0.6.2 pulls data.json and core.async into every cljs client, too heavy to buy keyword dispatch for a handful of sets.
The validating malli schemas for the time core's value objects.
Every schema here is CLOSED and validating, never shape-only:
[:and [:map {:closed true} ...] [:fn pred?]] -- the closed map pins the shape
(no stray keys) and the predicate pins the invariant, so a map that LOOKS
right but is not a real Day (2026-02-31, year 1) fails. Consumers (reitit,
the facade, calendario's wire layer) validate against these; the library
itself does not depend on them.
Reuse, never duplicate: the Zone and Local schemas are the ones zone.cljc
already defined and exports, and the closed sets (:enum) are the ones
error.cljc (Reason) and age.cljc (policies) already defined. Only Day,
Month, TimeOfDay and Period are NEW here, built on the predicates the earlier
steps exported (day?, month?, time-of-day?, period?).
An Instant is NOT a value object: it is epoch milliseconds, a long. So there
is no Instant schema; the instant CODEC (parse-instant / format-instant) is
in instant.cljc.
Closed sets are malli :enum, never hive-dsl defadt: hive-dsl 0.6.2 pulls
data.json and core.async into every cljs client, too heavy to buy keyword
dispatch for a handful of sets.The Day value object: {:year :month :day}, a real calendar day in 1900..2199.
The Day value object: {:year :month :day}, a real calendar day in 1900..2199.
The closed leap-policy set, from age.cljc.
The closed leap-policy set, from age.cljc.
The wall clock {:day Day :time TimeOfDay}, from zone.cljc.
The wall clock {:day Day :time TimeOfDay}, from zone.cljc.
The Month value object: {:year :month}, a month in 1900..2199.
The Month value object: {:year :month}, a month in 1900..2199.
The Period value object: {:start Day :end Day}, a closed, non-inverted run.
The Period value object: {:start Day :end Day}, a closed, non-inverted run.
The closed refusal-reason vocabulary, from error.cljc.
The closed refusal-reason vocabulary, from error.cljc.
The TimeOfDay value object: {:hour :minute :second}, each in range.
The TimeOfDay value object: {:hour :minute :second}, each in range.
The ZoneId value object (an IANA id string), from zone.cljc.
The ZoneId value object (an IANA id string), from zone.cljc.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |