Actions
Bug #73637
closedEpic #77562: Misbehaviors with datetime values and timezones
Extbase DateTimeConverter cannot handle negative timestamps
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?
Actions