Actions
Bug #89914
closedNative date (TCA dbType) fields are not properly copied or localized
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
DataHandler aka TCEmain
Target version:
-
Start date:
2019-12-11
Due date:
% Done:
100%
Estimated time:
TYPO3 Version:
10
PHP Version:
7.3
Tags:
Complexity:
Is Regression:
Sprint Focus:
Description
This bug was already reported by Ludwig Rafelsberger for TYPO3 7 (#79925). But the bug was closed without resolution. I just stumpled upon this behavior in TYPO3 v9.5.11
When you use a native DATE-field, translated or copied records will be off-by-one day
Prerequisites:- (Server) timezone with positive offset (e.g. Europe/Berlin)
TCA:
'type' => 'input', 'eval' => 'date', 'dbType' => 'date',
How to reproduce:
- Create such a new record (or use an existing one)
- Copy it
- Paste it
Expected result:
select * from tx_example_domain_model_event; uid pid some_int_based_tstamp some_native_dbtype_field 1 1 1487548800 2019-12-11 2 1 1487548800 2019-12-11 <-- the copied record as it should be
Actual result:
select * from tx_example_domain_model_event; uid pid some_int_based_tstamp some_native_dbtype_field 1 1 1487548800 2019-12-11 2 1 1487548800 2019-12-10 <-- the copied record with wrong date
What happens / the problem:
- The value "2019-12-11" is parsed in the local timezone 2019-12-11(T00:00:00+01:00) and converted to an timestamp (1576018800)
https://github.com/TYPO3/TYPO3.CMS/blob/b90897db1d13e3078609f1e66c4c91d2df465570/typo3/sysext/core/Classes/DataHandling/DataHandler.php#L1684
- The timestamp is now formatted as an UTC date (with gmdate) at 2019-12-10(T23:00:00+00:00)
https://github.com/TYPO3/TYPO3.CMS/blob/b90897db1d13e3078609f1e66c4c91d2df465570/typo3/sysext/core/Classes/DataHandling/DataHandler.php#L1740
Actions