Project

General

Profile

Actions

Bug #79557

open

Epic #77562: Misbehaviors with datetime values and timezones

Date fields DataMapper handling problem

Added by Oliver Pfaff about 7 years ago. Updated over 4 years ago.

Status:
New
Priority:
Must have
Assignee:
-
Category:
DataHandler aka TCEmain
Target version:
-
Start date:
2017-01-30
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
7.0
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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.


Files

data-mapper.png (26 KB) data-mapper.png Oliver Pfaff, 2017-01-30 15:47

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #80679: Input field eval datetime in FlexForm converts to wrong timestampClosed2017-04-04

Actions
Related to TYPO3 Core - Bug #79249: TCA fields with eval types "time" or "timesec" are incorrectly stored in the databaseClosedMarkus Klein2017-01-10

Actions
Actions #1

Updated by Oliver Pfaff about 7 years ago

The Code came in with this patch in Version 7.6.11 (the information could be useful).
https://forge.typo3.org/issues/74376

Actions #2

Updated by Mona Muzaffar about 7 years ago

  • Related to Bug #80679: Input field eval datetime in FlexForm converts to wrong timestamp added
Actions #3

Updated by Mona Muzaffar about 7 years ago

  • Related to Epic #80852: Datetime handling in backend added
Actions #4

Updated by Riccardo De Contardi almost 7 years ago

  • Parent task set to #77562
Actions #5

Updated by Riccardo De Contardi almost 7 years ago

  • Related to deleted (Epic #80852: Datetime handling in backend)
Actions #6

Updated by Gerrit Code Review over 6 years ago

  • Status changed from New to Under Review

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54231

Actions #7

Updated by Markus Klein over 6 years ago

  • Related to Bug #79249: TCA fields with eval types "time" or "timesec" are incorrectly stored in the database added
Actions #8

Updated by Susanne Moog about 5 years ago

  • Status changed from Under Review to New

Path has been abandoned.

Actions #9

Updated by Riccardo De Contardi over 4 years ago

  • Category set to DataHandler aka TCEmain
Actions

Also available in: Atom PDF