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

The month, day and year are each a role="spinbutton" named by their part, inside a role="group" the field's label names. Type digits: a segment moves on once no other digit could follow (a 4 in the month, two digits in the day), and typing the separator moves on too. ↑ / ↓ step a segment (an empty one starts from today), ← / → move between segments, Backspace deletes a digit, then moves back. @bind-Value is a DateOnly?, set once every segment is filled.

mmddyyyy

As on your passport.

Value: null

Time field

BitBhTimeField edits a TimeOnly? the same way. The English clock has an AM / PM segment (↑ / ↓ toggle it, A / P set it); HourCycle picks a 12- or 24-hour clock whatever the culture, and Granularity adds seconds or keeps to hours.

930AM
––––––

Start: 09:30 · Lap: null

Date and time

BitBhDateTimeField edits a DateTime?: the date segments, then the time segments, as one field — the focus runs on from the year into the hour. It takes the time field's Granularity and HourCycle, and Name posts yyyy-MM-ddTHH:mm, as <input type="datetime-local"> does. With a calendar to pick the date from, it is BitBhDateTimePicker (see the Date Picker page).

11222026930AM
221120260930

Value: 2026-11-22 09:30

Cultures

Culture orders the segments and picks the separators from its short date and time patterns: German writes dd.MM.yyyy and a 24-hour clock. A Persian culture edits the Persian calendar's year, month and day — the value is still a DateOnly, and with Dir right to left ← / → follow the segments as they are laid out. (This WebAssembly demo runs without ICU, where the Persian calendar isn't available.)

22112026
1405

Value: 2026-11-22

Limits and validation

A value outside Min / Max is kept and marks the field invalid (data-invalid on the group, aria-invalid on the segments). In an EditForm the field joins validation, BitBhErrorMessage describes the segments once invalid, and Name posts a hidden yyyy-MM-dd input.

mmddyyyy
An unhandled error has occurred. Reload 🗙