A date picker field

The date field generates a simple input with a nice date picker. It can be setup to display and store dates.


    label: Published on
    type: date

Field properties

Property Type Required Default Description
after mixed Optional text that will be shown after the input
autofocus bool Sets the focus on this field when the form loads. Only the first field with this label gets
before mixed Optional text that will be shown before the input
default mixed Default date when a new Page/File/User gets created
disabled bool If true, the field is no longer editable and will not be saved
help mixed Optional help text below the field
icon string calendar Changes the calendar icon to something custom
label mixed The field label can be set as string or associative array with translations
max string Youngest date, which can be selected/saved
min string Oldest date, which can be selected/saved
required bool If true, the field has to be filled in correctly to be saved.
time mixed false Pass true or an array of time field options to show the time selector.
translate bool true If false, the field will be disabled in non-default languages and cannot be translated. This is only relevant in multi-language setups.
when mixed Conditions when the field will be shown
width string 1/1 The width of the field in the field grid. Available widths: 1/1, 1/2, 1/3, 1/4, 2/3, 3/4

How to use in templates/snippets

To convert the value to a date object, use the toDate() method:

<?= $page->published()->toDate() ?>