DateInput
A date, or a date with time, with the date picker of the browser.
use Anvil\Schema\Fields\DateInput;
DateInput::make('due_on')->required(), // 05.11.2026 in German, Nov 5, 2026 in EnglishDateInput::make('starts_at')->withTime(), // 05.11.2026, 14:30DateInput::make('valid_until')->displayFormat('d.m.y'), // own format: 05.11.26Options
Section titled “Options”| Option | Effect | Default |
|---|---|---|
withTime() |
date and time (datetime-local), minutes |
date only |
displayFormat('d.m.Y') |
PHP date format of read-only values (detail page, repeater rows) | the format of the user’s language |
Plus the options of every field. The input itself always uses the browser’s picker, which shows the date in the format of the device.
Saved value
Section titled “Saved value”Y-m-d (DATE column), with time Y-m-d H:i:s (DATETIME column, in the
time zone of the application). Empty: null.
Validation
Section titled “Validation”valid_date[Y-m-d], with time valid_date[Y-m-d\TH:i] (the format the
browser sends), then the rules of rules().
Read-only
Section titled “Read-only”Without displayFormat() the date is shown in the format of the user’s
language (Anvil\Support\DateFormat, ICU medium format):
| Language | Date | With time |
|---|---|---|
| German | 05.11.2026 |
05.11.2026, 14:30 |
| English | Nov 5, 2026 |
Nov 5, 2026, 2:30 PM |
| French | 5 nov. 2026 |
5 nov. 2026 à 14:30 |
Set displayFormat() only when a field needs a fixed format regardless of
the language. Values that are no date are shown empty.
ISO 8601: "2026-10-25" (format: date), with time
"2026-10-25T14:30:00+01:00" (format: date-time). Requests send dates as
YYYY-MM-DD; date-times with optional seconds and offset (Z, +01:00)
are converted into the time zone of the application.