Date and time input types provide browser controls that submit normalized value strings.
HTML date and time inputs: separate display from submitted values
When the element earns its place
A warehouse schedules a collection window for a damaged parcel. A date field records the local calendar day; a time field records a wall-clock time. Neither field identifies a timezone or resolves daylight-saving ambiguity, so the server must attach the depot's configured zone before it creates an instant. Labels state what the values mean. Boundaries should reflect operational rules, not arbitrary dates copied into a template.
<form action="/collections/schedule" method="post">
<label for="collection-day">Collection day at the depot</label>
<input id="collection-day" name="collection_day" type="date" min="2026-10-02" required>
<label for="collection-time">Local pickup time</label>
<input id="collection-time" name="collection_time" type="time" step="900" required>
<button type="submit">Request collection</button>
</form>Behavior boundary
The date minimum here illustrates a stated scheduling rule and must be generated from current policy on a live page. The server must reject expired dates, closed hours, and conflicting reservations regardless of browser validation.
Cost and operational limits
Native controls avoid a custom picker bundle. Server-side timezone conversion and availability checks still consume work, and the correct cost depends on the scheduling service rather than on the input element.
Common Mistakes
- Do not treat a time value as an absolute instant.
- Do not hard-code a date bound that will expire.
- Do not rely on the browser to prevent conflicting bookings.
Connected lessons
- HTML input types: choose controls from the value contract
- HTML constraint validation: improve feedback without trusting the browser
- HTML time and data: pair readable copy with machine-readable values
Continue with HTML number boundaries: align min, max, and step with the real unit.
