DateTime¶
The DateTime
type provides a date picker. If not configured otherwise, the
value is stored as a timestamp.
It corresponds with the TCA type => 'datetime'
.
SQL overrides via alternativeSql
allowed: no.
Settings¶
-
default
¶ Required: false Type: string Default: ‘’ Default value in
Y-m-d
format. Set if a new record is created. For example2023-01-01
.
-
dbType
¶ Required: false Type: string Default: ‘’ This option changes the date field to a native MySql
DATETIME
,DATE
orTIME
field. Possible values aredatetime
,date
ortime
respectively.
-
range
¶ Required: false Type: array An array which defines an integer range within which the value must be. Keys:
- lower (string in format
H:i Y-m-d
) - Defines the min date.
- upper (string in format
H:i Y-m-d
) - Defines the max date.
It is allowed to specify only one of both of them.
Example:
range: lower: '2020-01-01' upper: '2020-12-31'
- lower (string in format
-
required
¶ Required: false Type: boolean Default: false If set, the field becomes mandatory.
For more advanced configuration refer to the TCA documentation.
Examples¶
Minimal¶
name: example/datetime
group: common
fields:
- identifier: datetime
type: DateTime
name: example/datetime
group: common
fields:
- identifier: datetime
type: DateTime
dbType: datetime
Advanced / use case¶
name: example/datetime
group: common
fields:
- identifier: datetime
type: DateTime
default: '2023-02-11 12:00:00'
disableAgeDisplay: true
size: 20
range:
lower: '2019-01-31 12:00:00'
upper: '2040-01-31 12:00:00'
required: true