[DateRange] 

Validation error codes 

  • Error code: 1521293685
  • Error message: You must enter an instance of DateTime.
  • Error code: 1521293686
  • Error message: You must select a date before %s.
  • Error code: 1521293687
  • Error message: You must select a date after %s.
  • Error code: 1748345955
  • Error message: This field cannot be validated due to a configuration error. Please contact the website owner.

Properties 

implementationClassName 

Option path
prototypes.<prototypeIdentifier>.validatorsDefinition.DateRange.implementationClassName
Data type
string
Needed by
Frontend
Mandatory
Yes
Default value (for prototype 'standard')
DateRange:
  implementationClassName: TYPO3\CMS\Form\Mvc\Validation\DateRangeValidator
Copied!
Good to know
Description

Classname which implements the validator.

options.format 

Option path
prototypes.<prototypeIdentifier>.validatorsDefinition.DateRange.options.format
Data type
string
Needed by
Frontend
Mandatory
Yes
Default value (for prototype 'standard')
DateRange:
  options:
    format: Y-m-d
Copied!
Description
The format of the minimum and maximum option.

options.minimum 

Option path
prototypes.<prototypeIdentifier>.validatorsDefinition.DateRange.options.minimum
Data type
string
Needed by
Frontend
Mandatory
Yes
Default value (for prototype 'standard')
undefined
Description

The minimum date. Use an absolute date in the format of options.format or a relative date expression.

New in version 14.2 Feature: #106681 - Support relative date formats in DateRange validator

Relative date expressions.

A relative date expression follows the syntax of the PHP function strtotime(). Examples are today, tomorrow, -18 years, and +1 month. The expression is evaluated when the form is validated. Absolute and relative dates can be mixed in one validator.

The validator compares dates at midnight, so the time of day is ignored. If a value cannot be parsed, the validator adds the configuration error 1748345955 and logs the details.

For a Date element, the form editor also writes the values into the HTML min and max attributes of the field. Relative expressions in these attributes are resolved to absolute Y-m-d dates when the form is rendered.

Example: The date of birth must be at least 18 years ago
type: Date
identifier: date-of-birth
label: 'Date of birth'
validators:
  -
    identifier: DateRange
    options:
      minimum: '1900-01-01'
      maximum: '-18 years'
Copied!

options.maximum 

Option path
prototypes.<prototypeIdentifier>.validatorsDefinition.DateRange.options.maximum
Data type
string
Needed by
Frontend
Mandatory
Yes
Default value (for prototype 'standard')
undefined
Description

The maximum date. Use an absolute date in the format of options.format or a relative date expression. The rules for relative date expressions are described in options.minimum.

New in version 14.2 Feature: #106681 - Support relative date formats in DateRange validator

Relative date expressions.

formEditor.iconIdentifier 

Option path
prototypes.<prototypeIdentifier>.validatorsDefinition.DateRange.formEditor.iconIdentifier
Data type
string
Needed by
Backend (form editor)
Mandatory
Yes
Default value (for prototype 'standard')
DateRange:
  formEditor:
    iconIdentifier: form-validator
    label: formEditor.elements.FormElement.validators.DateRange.editor.header.label
Copied!
Description

An icon identifier which must be registered through the \TYPO3\CMS\Core\Imaging\IconRegistry . This icon will be shown within the - "Inspector [CollectionElementHeaderEditor]" if the validator is selected.

formEditor.label 

Option path
prototypes.<prototypeIdentifier>.validatorsDefinition.DateRange.formEditor.label
Data type
string
Needed by
Backend (form editor)
Mandatory
Yes
Default value (for prototype 'standard')
DateRange:
  formEditor:
    iconIdentifier: form-validator
    label: formEditor.elements.FormElement.validators.DateRange.editor.header.label
Copied!
Good to know
Description

This label will be shown within the - "Inspector [CollectionElementHeaderEditor]" if the validator is selected.

formEditor.predefinedDefaults 

Option path
prototypes.<prototypeIdentifier>.validatorsDefinition.DateRange.formEditor.predefinedDefaults
Data type
array
Needed by
Backend (form editor)
Mandatory
No
Default value (for prototype 'standard')
DateRange:
  formEditor:
    predefinedDefaults:
      options:
        minimum: ''
        maximum: ''
Copied!
Description

Defines predefined defaults for validator options which are prefilled, if the validator is added to a form element.