Project

General

Profile

Actions

Bug #73637

closed

Epic #77562: Misbehaviors with datetime values and timezones

Extbase DateTimeConverter cannot handle negative timestamps

Added by Felix Althaus about 8 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2016-02-23
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.5
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Using negative unix timestamp (signed integer, before unix epoch), \TYPO3\CMS\Extbase\Property\TypeConverter\DateTimeConverter fails to convert from timestamp to \DateTime.
This happens because \DateTime::createFromFormat('U', $timestamp) does not support negative timestamps.
\DateTime::__construct() as well as \DateTime::setTimestamp() do the job - though they treat timezones differently.

$date = new \DateTime('@' . $timestamp));

or
$date = (new \DateTime())->setTimestamp($timestamp);

The converter class seems to be intended somewhat independent of target type. That‘s why I‘m unsure both about how to write test and implementation.
Any suggestions?


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #72053: Extbase: Support \DateTimeInterface instead of \DateTimeClosed2015-12-04

Actions
Actions

Also available in: Atom PDF