Date & time pickers
A segmented field you type into, and a calendar. Day-first for en-IN, read in the place's zone.
<input type="date">
is the posted field underneath, so forms also work without JavaScript.
Date, with rules
A
SutraUI.DateRules
struct disables days in the calendar, marks a typed value it refuses, and checks the same on the server with
DateRules.validate/4
.
Here: from today to 90 days ahead, no weekends, no 25 Dec, times on the quarter hour. Presets today, tomorrow, next Monday and end of week come with the picker.
Date range
A range posts
name[start]
and
name[end]
and shows its length as you draw it. In a filter,
preset_key
also posts
name[preset]
so a shared link stays relative ("last 7 days").
Presets
presets
takes keys,
{key, label}
pairs, or maps with a value of your own.
presets={[]}
turns them off.
A zoned datetime and a clock change
datetime_picker
shows and posts the wall time in its required
zone
with that moment's offset. A clock change is shown, never guessed:
on 1 Nov 2026 New York repeats the hour 01:00 to 02:00, so 01:30 happens twice and the picker offers "01:30 EDT" and "01:30 EST".
On 14 Mar 2027 the hour 02:00 to 03:00 does not exist, so 02:30 posts nothing and says so.
When your browser's zone differs, your own time is added as a hint.
Ambiguous: 2026-11-01T01:30:00-04:00 or 2026-11-01T01:30:00-05:00
Inside a dialog
The calendar is a fixed card placed from the field, so a dialog body does not clip it. Below 640 px it is a bottom sheet.
Plan a visit
Choose a campus and a day.
Notes
-
The segment order comes from
config :sutra_ui, locale: "en-IN"(or thelocaleattribute), never from the viewer's browser. -
The picker fires the input's own
inputandchangeevents, sophx-changeandused_input?work as with any input. -
Read a datetime with
SutraUI.Time.parse_datetime/3. -
Each picker draws its own label, description and errors, like
<.input>(errors come fromfield; passerrorsotherwise). Passbareto lay the label out yourself.