#79557Date fields DataMapper handling problem
Description
Hello everybody,
the handling of date fields seems incorrect in \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper here we have(without the debugs :) ):
if (!is_null($columnMap) && !is_null($columnMap->getDateTimeStorageFormat())) {
$storageFormat = $columnMap->getDateTimeStorageFormat();
$timeZoneToStore = clone $input;
DebuggerUtility::var_dump($timeZoneToStore,'datetime in mapper after clone');
// set to UTC to store in database
$timeZoneToStore->setTimezone(new \DateTimeZone('UTC'));
DebuggerUtility::var_dump($timeZoneToStore,'datetime after timezone switch');
switch ($storageFormat) {
case 'datetime':
$parameter = $timeZoneToStore->format('Y-m-d H:i:s');
break;
case 'date':
$parameter = $timeZoneToStore->format('Y-m-d');
DebuggerUtility::var_dump($parameter,'formatted date parameter');
break;
default:
throw new \InvalidArgumentException('Column map DateTime format "' . $storageFormat . '" is unknown. Allowed values are datetime or date.', 1395353470);
}
Now i have a date field in a form, where only the date is stored, the time part is 00:00:00.
Im from Germany and my datetime has the timezone +1. After the UTC switch i have the time 23:00:00 from the day before and this date will go to the DB.
When we get the value from the DB extbase will add my timezone but unfortunately to the wrong date :D
You can see the debugs from the code in the attached screenshot.
Reviews 1
Related issues 4
- Bug #79249TCA fields with eval types "time" or "timesec" are incorrectly stored in the database
- Bug #80349Extbase mapping of \DateTime for integer values does not set timezone with region string but only offset
- Bug #80679Input field eval datetime in FlexForm converts to wrong timestamp
- Bug #91240Extbase DateTime with native dbType=datetime converts output differently
Files 1
History 1314
-
Mona Muzaffar changed Related to #80679 <span data-processor="relativetime" data-value="2017-04-15T00:06:51+00:00" > 04/15/17, 00:06 </span>
-
Mona Muzaffar changed Related to #80852 <span data-processor="relativetime" data-value="2017-04-15T00:40:10+00:00" > 04/15/17, 00:40 </span>
-
Riccardo De Contardi changed parent task #77562 <span data-processor="relativetime" data-value="2017-06-07T13:02:58+00:00" > 06/07/17, 13:02 </span>
-
Riccardo De Contardi changed
Related to #80852<span data-processor="relativetime" data-value="2017-06-07T13:03:16+00:00" > 06/07/17, 13:03 </span> -
Gerrit Code Review pushed patch set 1 for TYPO3_8-7 to change 54231 status
NewUnder Review <span data-processor="relativetime" data-value="2017-09-29T11:15:56+00:00" > 09/29/17, 11:15 </span> -
Markus Klein changed Related to #79249 <span data-processor="relativetime" data-value="2017-09-29T13:47:23+00:00" > 09/29/17, 13:47 </span>
-
Susanne Moog commented and changed status
Under ReviewNew <span data-processor="relativetime" data-value="2019-03-01T19:25:23+00:00" > 03/01/19, 19:25 </span>Path has been abandoned.
-
Riccardo De Contardi changed category <span data-processor="relativetime" data-value="2019-08-26T22:53:14+00:00" > 08/26/19, 22:53 </span>
-
Benni Mack changed Related to #80349 <span data-processor="relativetime" data-value="2024-06-24T11:54:43+00:00" > 06/24/24, 11:54 </span>
-
Benjamin Franzke commented and changed status
NewResolved <span data-processor="relativetime" data-value="2025-03-18T20:34:38+00:00" > 03/18/25, 20:34 </span>Hi, this issue is a duplicate of #79613 which itself has been resolved in TYPO3 v11.0 with #91240.
See https://forge.typo3.org/issues/79613#note-14 for more information.Please report back if you see this issue still happening with TYPO3 v12 or v13.
-
Benjamin Franzke changed Duplicates #79613 <span data-processor="relativetime" data-value="2025-03-18T20:34:47+00:00" > 03/18/25, 20:34 </span>
-
Benjamin Franzke changed Related to #91240 <span data-processor="relativetime" data-value="2025-03-18T20:34:59+00:00" > 03/18/25, 20:34 </span>
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2025-12-02T14:36:43+00:00" > 12/02/25, 14:36 </span>
The Code came in with this patch in Version 7.6.11 (the information could be useful).
https://forge.typo3.org/issues/74376