Date & time pickers

A segmented field you type into, and a calendar. Day-first for en-IN, read in the place's zone.

Type digits and the field moves on; arrow keys step a segment; paste reads a whole value. On phones the field opens the number keyboard and the calendar becomes a bottom sheet. The browser's own <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.

Booking form

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").

Date range

Presets

presets takes keys, {key, label} pairs, or maps with a value of your own. presets={[]} turns them off.

Presets

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.

America/New_York

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.

In a dialog

Notes

  • The segment order comes from config :sutra_ui, locale: "en-IN" (or the locale attribute), never from the viewer's browser.
  • The picker fires the input's own input and change events, so phx-change and used_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 from field ; pass errors otherwise). Pass bare to lay the label out yourself.

Are you sure?