Project

General

Profile

Bug #89914

Updated by Imko Schumacher about 4 years ago

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: 
 <pre> 
   'type' => 'input', 
   'eval' => 'date', 
   'dbType' => 'date', 
 </pre> 

 How to reproduce: 

 * Create such a new record (or use an existing one) 
 * Copy it 
 * Paste it 

 Expected result: 
 <pre> 
   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 
 </pre> 

 Actual result: 

 <pre> 
   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 
 </pre> 


 What happens / 

 If it's a translation and you open the problem: original record and save it again, the date of the translation will get adjusted, if it's l10n_mode=exclude. 

 * The value "2019-12-11" As far as I can see, the problem is parsed in that the *local timezone* 2019-12-11(T00:00:00+01:00) and date is first converted from "2019-12-11" to an timestamp (1576018800) 
   https://github.com/TYPO3/TYPO3.CMS/blob/b90897db1d13e3078609f1e66c4c91d2df465570/typo3/sysext/core/Classes/DataHandling/DataHandler.php#L1684 a unix-timestamp: 
 https://github.com/TYPO3/TYPO3.CMS/blob/ba5a118594e0d0b4afb4f66f336ef9ad3074da02/typo3/sysext/core/Classes/DataHandling/DataHandler.php#L1770 

 * 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 Then it's converted back to a date, but using gmdate instead of date: 
 https://github.com/TYPO3/TYPO3.CMS/blob/ba5a118594e0d0b4afb4f66f336ef9ad3074da02/typo3/sysext/core/Classes/DataHandling/DataHandler.php#L1826 

Back