Skip to content

Date Field / Time Field

Segmented date, time and date-time inputs: each part is a spinbutton, in the order and with the separators the reader's culture writes them.

Styled with CSS Tailwind

Date field

Each part is a role="spinbutton" in a role="group" named by the field's label. Type digits (a segment moves on once full), step with ↑ / ↓, move with ← / →. The segments are styled through the field: [&_[role=spinbutton]]: for the editable ones, [&_[data-placeholder]]: for the empty ones; the field gets data-[focused]: while a segment has focus.

mmddyyyy

As on your passport.

Value: null

Time field

BitBhTimeField edits a TimeOnly?: an AM / PM segment on a 12-hour clock (A / P set it), HourCycle and Granularity to change the clock and the parts.

930AM
––––––

Start: 09:30 · Lap: null

Date and time

BitBhDateTimeField edits a DateTime?: the date segments and the time segments as one field, the focus running on from the year into the hour, with the time field's Granularity and HourCycle. The same utilities style it.

11222026930AM
221120260930

Value: 2026-11-22 09:30

Cultures

German orders the segments dd.MM.yyyy and uses a 24-hour clock; a Persian culture edits the Persian calendar's parts, right to left. (This WebAssembly demo runs without ICU, where the Persian calendar isn't available.)

22112026
1405

Limits and validation

A value outside Min / Max marks the field invalid (data-[invalid]:); in an EditForm it joins validation and BitBhErrorMessage describes it.

mmddyyyy
An unhandled error has occurred. Reload 🗙