Feature: #97232 - New TCA type "datetime"

See forge#97232

Description

Especially TCA type input has a wide range of use cases, depending on the configured renderType and the eval options. Determination of the semantic meaning is therefore usually quite hard and often leads to duplicated checks and evaluations in custom extension code.

In our effort of introducing dedicated TCA types for all those use cases, the TCA type datetime has been introduced. It replaces the renderType=inputDateTime of TCA type input.

The TCA type datetime features the following column configuration:

  • behaviour: allowLanguageSynchronization
  • dbType: date, time, datetime
  • default
  • disableAgeDisplay
  • fieldControl
  • fieldInformation
  • fieldWizard
  • format: datetime (default), date, time, timesec
  • mode
  • nullable
  • placeholder
  • range: lower, upper
  • readOnly
  • required
  • search
  • size

The following column configuration can be overwritten by page TSconfig:

  • readOnly
  • size

A complete migration from renderType=inputDateTime to type=datetime looks like the following:

 // Before

 'a_datetime_field' => [
     'label' => 'Datetime field',
     'config' => [
         'type' => 'input',
         'renderType' => 'inputDateTime',
         'required' => true,
         'size' => 20,
         'max' => 1024,
         'eval' => 'date,int',
         'default' => 0,
     ],
 ],

// After

 'a_datetime_field' => [
     'label' => 'Datetime field',
     'config' => [
         'type' => 'datetime',
         'format' => 'date',
         'required' => true,
         'size' => 20,
         'default' => 0,
     ]
 ]
Copied!

An automatic TCA migration is performed on the fly, migrating all occurrences to the new TCA type and triggering a PHP E_USER_DEPRECATED error where code adoption has to take place.

Automatic database fields

TYPO3 automatically creates database fields for TCA type datetime columns, if they have not already been defined in an extension's ext_tables.sql file. This also supports columns, having a native database type (dbType) defined. Fields without a native type always define default 0 and are always signed (to allow negative timestamps). As long as a column does not use nullable=true, the fields are also always defined as NOT NULL.

Impact

It's now possible to simplify the TCA configuration by using the new dedicated TCA type datetime. Next to reduced TCA configuration, the new type allows to omit the corresponding database field definition.