Skip to content

date

The date field supports saving dates in YYYY-MM-DD format. The interface is a standard date input.

Module field definition

javascript
// Configuring the `birthday` field in a module's `fields.add` subsection:
birthday: {
  label: 'What is your birthday?',
  type: 'date'
}

Settings

Required

PropertyTypeDefaultDescription
labelStringn/aSets the visible label for the field in the UI
typeStringn/aSpecifies the field type (date for this type)

Optional

PropertyTypeDefaultDescription
defStringn/aThe default value for the field. Must be in YYYY-MM-DD format.
helpStringn/aHelp text for the content editor
htmlHelpStringn/aHelp text with support for HTML markup
ifObject{}Conditions to meet before the field is active. See the guide for details.
requiredIfObject{}Conditions to meet before the field is required. See the guide for details.
hiddenBooleanfalseIf true, the field is hidden
maxStringn/aThe maximum allowed date value for the field. Must be a date format (e.g., YYYY-MM-DD)
minStringn/aThe minimum allowed date value for the field. Must be a date format (e.g., YYYY-MM-DD)
requiredBooleanfalseIf true, the field is mandatory
readOnlyBooleanfalseIf true, prevents the user from editing the field value

Use in templates

A date value will often be paired with the date template filter.

nunjucks
Their birthday is {{ data.piece.birthday | date('MMMM D, YYYY') }}.