Epic #77562: Misbehaviors with datetime values and timezones
Saving wrong Date into DB if Field is of type DATE
According to this Bugfix:
I can Confirm the Problem from Viktor Livakivskyis comment:
There is a special case with DB fields of type 'date'.
Imagine a case, when a DateTime object is created in "Europe/Berlin" like this
$dateObject = new \DateTime('2016-07-13');
This will correspond to 2016-07-13 00:00:00.000000 in timezone "Europe/Berlin".
So, in case ExtBase will convert it to UTC during persistence, the date will correspond to 2016-07-12 22:00:00.000000 in UTC timezone. And saved to DB will result in "2016-07-12" stored.
Then on retrieval from DB the DateTime object will be created and Timezone shift added, which will correspond to 2016-07-12 02:00:00.000000 in "Europe/Berlin".
One day is lost then.
So, for case with native DB 'date' field the timezone shift should be totally ignored.
Please respect suggestion from "This Mächler":
Make it possible to choose how TYPO3 should treat dateTime values:
1. TYPO3 assumes that dateTime values from the DB are in local time and need no conversion from/to the FE or BE. This should be the default setting to avoid breaking a running system.
2. TYPO3 assumes that dateTime values are stored in UTC, conversion takes place from/to the FE or BE.
This will not solve the problem with the already implemented workarounds. Maybe there is no solution for that.