Actions
Feature #72149
closedSupport \DateTimeInterface in Format\DateViewHelper
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2015-12-10
Due date:
% Done:
100%
Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:
Description
The DateViewHelper only supports DateTime objects or Unix Timestamps, but instead of checking for a concrete DateTime object it should support the DateTimeInterface. The way it is now, you can't work with \DateTimeImmutable objects.
Relevant code:
if (!$date instanceof \DateTime) { try { $base = $base instanceof \DateTime ? $base->format('U') : strtotime((MathUtility::canBeInterpretedAsInteger($base) ? '@' : '') . $base); $dateTimestamp = strtotime((MathUtility::canBeInterpretedAsInteger($date) ? '@' : '') . $date, $base); $date = new \DateTime('@' . $dateTimestamp); $date->setTimezone(new \DateTimeZone(date_default_timezone_get())); } catch (\Exception $exception) { throw new Exception('"' . $date . '" could not be parsed by \DateTime constructor: ' . $exception->getMessage(), 1241722579); } }
Updated by Gerrit Code Review almost 9 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/45218
Updated by Morton Jonuschat almost 9 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 737125d67d642c5edb8e5683fff3e902760c3611.
Actions