Pure model layer for x-calendar. No DOM, no side effects — every
function is a value transform. Dates flow as ISO "YYYY-MM-DD" strings;
the canonical model holds only value-comparable data (strings, keywords,
numbers, sets) so the render change-guard can compare it with not=.
UTC date math lives in baredom.utils.dates.
Pure model layer for x-calendar. No DOM, no side effects — every function is a value transform. Dates flow as ISO "YYYY-MM-DD" strings; the canonical model holds only value-comparable data (strings, keywords, numbers, sets) so the render change-guard can compare it with `not=`. UTC date math lives in baredom.utils.dates.
(canonicalize {:keys [mode value start end min max disabled-dates
first-day-of-week locale month-raw disabled?
show-week-numbers? range-allow-same-day? auto-swap?
today]})Build the stable, value-comparable model from raw attribute strings.
today is a JS Date supplied by the caller. The returned map holds only
strings/keywords/numbers/sets so the render change-guard can compare it.
Build the stable, value-comparable model from raw attribute strings. `today` is a JS Date supplied by the caller. The returned map holds only strings/keywords/numbers/sets so the render change-guard can compare it.
(compute-cell-flags {:keys [mode value start end min max disabled-set]}
cell-iso
in-month?
today-iso)Derive the display flags for a single calendar day cell.
model is the canonicalized map, cell-iso the cell's ISO date,
in-month? whether it belongs to the displayed month, and today-iso
today's ISO date. All output booleans are explicitly coerced.
Derive the display flags for a single calendar day cell. `model` is the canonicalized map, `cell-iso` the cell's ISO date, `in-month?` whether it belongs to the displayed month, and `today-iso` today's ISO date. All output booleans are explicitly coerced.
(date->year-month d)JS Date → "YYYY-MM" (the month attribute format).
JS Date → "YYYY-MM" (the `month` attribute format).
(displayed-month {:keys [month-raw value-d start-d today]})Resolve which month the grid shows, as a UTC Date on the 1st.
Priority: explicit month attr → month of the selected value/start →
today. today must be supplied by the caller (keeps this pure).
Resolve which month the grid shows, as a UTC Date on the 1st. Priority: explicit `month` attr → month of the selected value/start → `today`. `today` must be supplied by the caller (keeps this pure).
(month-label d locale)Localized "<Month> <Year>" label for a UTC month Date.
Localized "<Month> <Year>" label for a UTC month Date.
(month-options locale)Twelve {:index 0-11 :label "<Month>"} entries for the quick-jump panel, localized.
Twelve {:index 0-11 :label "<Month>"} entries for the quick-jump panel,
localized.(parse-disabled-dates s)Parse a space/comma-separated list of ISO dates into a set of ISO strings. Entries that are not valid ISO dates are dropped.
Parse a space/comma-separated list of ISO dates into a set of ISO strings. Entries that are not valid ISO dates are dropped.
(parse-first-dow s)Parse the first-day-of-week attribute. Accepts a digit 0-6 or a weekday word (case-insensitive). Returns 0 (Sunday) for anything unrecognised.
Parse the first-day-of-week attribute. Accepts a digit 0-6 or a weekday word (case-insensitive). Returns 0 (Sunday) for anything unrecognised.
(parse-mode s)Returns :single or :range. Default is :single.
Returns :single or :range. Default is :single.
(parse-year-month s)Parse a "YYYY-MM" (or full "YYYY-MM-DD") string to a UTC Date at the 1st of that month, or nil.
Parse a "YYYY-MM" (or full "YYYY-MM-DD") string to a UTC Date at the 1st of that month, or nil.
(safe-locale s)Normalize a raw locale attribute and return it only when it is a tag
Intl.DateTimeFormat accepts; otherwise nil so callers fall back to the
runtime default. Guards every Intl call site from a RangeError that would
otherwise crash the render.
Normalize a raw `locale` attribute and return it only when it is a tag `Intl.DateTimeFormat` accepts; otherwise nil so callers fall back to the runtime default. Guards every Intl call site from a RangeError that would otherwise crash the render.
(weekday-names locale fdow)Seven short weekday labels, localized, starting at fdow
(0=Sunday..6=Saturday).
Seven short weekday labels, localized, starting at `fdow` (0=Sunday..6=Saturday).
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 |