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 Default Description

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


Optional text that will be shown before the input


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

format string

Defines a custom format that is used when the field is saved


Optional help text below the field

icon string calendar

Changes the calendar icon to something custom


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 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.


Conditions when the field will be shown (since 3.1.0)

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.

Without a date format, the toDate() field method renders a UNIX timestamp:

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

Use a date format to render the date in your desired output format:

<?= $page->published()->toDate('Y-m-d') ?>

If you have set the date handler to strftime in your config, use the corresponding format syntax:

<?= $page->published()->toDate('%Y-%m-%d') ?>