Bug #51918

Native date and datetime values do not consider timezone

Added by Oliver Hader about 6 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend API
Target version:
Start date:
2013-09-11
Due date:
% Done:

100%

TYPO3 Version:
6.1
PHP Version:
5.3
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:

Description

The TCA configuration property "dbType" allows to store "date" or "datetime" values directly in the database (instead of using a timestamp value).
However, the timezone is not recognized correctly - besides that, the serverTimeZone is applied which does not make much sense at all, since it leaves out DST handling.

See #32081 for a full description on how times/dates are stored in TYPO3 and how they are converted.

The current scenario is:
  • being on GMT+0200 (Europe/Berlin with DST - which is "CEST")
  • serverTimeZone is set to "1" in Install Tool
  • using the time "2013-09-30 00:00:00"
  • timestamp (UTC) representation is sent to DataHandler
    • "1380499200"
  • incoming fields are converted to represent the native date
    • "2013-09-30 02:00:00" (because using date() instead of gmdate())
    • "2013-09-30 00:00:00" would be correct here
  • native date is converted to timestamp again (should be UTC still)
    • "1380492000" (7200 seconds are missing, due to wrong timezone handling)
    • "1380499200" would be correct (as submitted to DataHandler)
  • serverTimeZone is added
    • "1380495600" (3600 seconds are missing)
    • "1380499200" would be correct (as submitted to DataHandler)
  • timezone offset is substracted
  • timestamp gets converted back to native date
    • "1380488400" -> "2013-09-29 23:00:00"
    • "1380492000" would be correct (timezone cleared value for local date() handling)

Related issues

Related to TYPO3 Core - Bug #21466: Deprecate serverTimezone Closed 2009-11-05
Related to TYPO3 Core - Feature #38965: Add support for native date/time fields Closed 2012-07-15
Related to TYPO3 Core - Bug #59613: DateTime values in BE are shown in UTC Rejected 2014-06-16
Related to TYPO3 Core - Feature #61110: Support for timezones in all date fields in TYPO3 BE New 2014-08-21

Associated revisions

Revision 74f47123 (diff)
Added by Oliver Hader about 6 years ago

[BUGFIX] Native date and datetime values do not consider timezone

The TCA configuration property "dbType" allows to store "date"
or "datetime" values directly in the database (instead of using
a timestamp value).
However, the timezone is not recognized correctly - besides that,
the serverTimeZone is applied which does not make much sense at
all, since it leaves out DST handling.

Fixes: #51918
Releases: 6.0, 6.1, 6.2
Change-Id: I45da65d8cee2611358303e93305cb5c793223746
Reviewed-on: https://review.typo3.org/23749
Reviewed-by: Markus Klein
Reviewed-by: Stefan Neufeind
Tested-by: Markus Klein
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader

Revision 0641f4ff (diff)
Added by Oliver Hader about 6 years ago

[BUGFIX] Native date and datetime values do not consider timezone

The TCA configuration property "dbType" allows to store "date"
or "datetime" values directly in the database (instead of using
a timestamp value).
However, the timezone is not recognized correctly - besides that,
the serverTimeZone is applied which does not make much sense at
all, since it leaves out DST handling.

Fixes: #51918
Releases: 6.0, 6.1, 6.2
Change-Id: I45da65d8cee2611358303e93305cb5c793223746
Reviewed-on: https://review.typo3.org/25367
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader

Revision e6b77d8f (diff)
Added by Oliver Hader about 6 years ago

[BUGFIX] Native date and datetime values do not consider timezone

The TCA configuration property "dbType" allows to store "date"
or "datetime" values directly in the database (instead of using
a timestamp value).
However, the timezone is not recognized correctly - besides that,
the serverTimeZone is applied which does not make much sense at
all, since it leaves out DST handling.

Fixes: #51918
Releases: 6.0, 6.1, 6.2
Change-Id: I45da65d8cee2611358303e93305cb5c793223746
Reviewed-on: https://review.typo3.org/25368
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader

History

#1 Updated by Philipp Gampe about 6 years ago

IMHO we should store dates+times as UTC and do the conversion on the fly.

#2 Updated by Gerrit Code Review about 6 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/23749

#3 Updated by Oliver Hader about 6 years ago

Philipp Gampe wrote:

IMHO we should store dates+times as UTC and do the conversion on the fly.

Good idea, however timestamps have been stored for the local (default) timezone for ages already... For backwards-compatibility we stay with our holy cow.

#4 Updated by Gerrit Code Review about 6 years ago

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

#5 Updated by Gerrit Code Review about 6 years ago

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

#6 Updated by Oliver Hader about 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#7 Updated by Benni Mack about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF