Bug #73637
closedEpic #77562: Misbehaviors with datetime values and timezones
Extbase DateTimeConverter cannot handle negative timestamps
100%
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?
Updated by Felix Althaus about 8 years ago
Does #72053 (Extbase: Support \DateTimeInterface instead of \DateTime) need to be considered?
Updated by Mona Muzaffar about 7 years ago
- Related to Epic #80852: Datetime handling in backend added
Updated by Riccardo De Contardi almost 7 years ago
- Related to deleted (Epic #80852: Datetime handling in backend)
Updated by Benni Mack about 4 years ago
- Related to Feature #72053: Extbase: Support \DateTimeInterface instead of \DateTime added
Updated by Gerrit Code Review over 3 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65834
Updated by Gerrit Code Review over 3 years ago
Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65821
Updated by Benni Mack over 3 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset d075ae6e1ddc48359365792101300c239f9dca20.