Project

General

Profile

Actions

Bug #79613

open

Epic #77562: Misbehaviors with datetime values and timezones

Saving wrong Date into DB if Field is of type DATE

Added by Sascha Rademacher about 7 years ago. Updated over 6 years ago.

Status:
New
Priority:
Must have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2017-02-03
Due date:
% Done:

0%

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

Description

According to this Bugfix:
https://forge.typo3.org/issues/72878

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":

Suggestion:
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.


Related issues 5 (1 open4 closed)

Related to TYPO3 Core - Bug #79925: Native date/datetime (TCA dbType) fields are not properly copied or localizedClosedLudwig Rafelsberger2017-02-20

Actions
Related to TYPO3 Core - Feature #80559: datetime and time handling should always have timezone informationClosed2017-03-29

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

Actions
Related to TYPO3 Core - Bug #72878: wrong datetime handling, they are not UTC in dbClosed2016-01-21

Actions
Related to TYPO3 Core - Bug #68651: Datetime() properties have wrong timezoneAcceptedAndreas Wolf2015-07-30

Actions
Actions

Also available in: Atom PDF