Actions
Bug #81548
closedTCA empty input with renderType => inputDateTime with dbType => date gives error on save
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2017-06-12
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
Description
When I save a not filled (empty) date, I get the following error in CMS 8.7
1: These fields of record 1 in table "tx_my_ext" have not been saved correctly: birthdate! The values might have changed due to type casting of the database.
I have an extension with the following TCA
'birthdate' => [
'exclude' => 1,
'label' => $labelReferencePrefix . 'tx_my_ext.birthdate',
'config' => [
'renderType' => 'inputDateTime',
'dbType' => 'date',
'type' => 'input',
'size' => 7,
'eval' => 'date',
'checkbox' => 0,
'default' => '0000-00-00'
],
],
and the following sql declaration in the ext_tables.sql
birthdate date DEFAULT '0000-00-00',
When I change the table to varchar
, the date is saved as 0
while empty
I think the problem is in the 'eval' => 'date'
according to the documentation
The field will evaluate the input as a date, automatically converting the input to a UNIX-time in seconds.
But this is only a problem when the value is empty, when it's filled there is no problem.
I can't remove the eval because this is required when you set
'renderType' => 'inputDateTime'
Actions