Bug #95396
closedJsonView missing support for DateTimeImmutable
100%
Description
JsonView does "support" DateTime, because it automatically transforms it by formatting to ATOM.
The variant DateTimeImmutable is not formatted as ATOM, instead its properties will be listed. (offset and timestamp).
Controller code:
public function listAction(): void { if ($this->view instanceof JsonView) { $this->view->setVariablesToRender(['publications']); $this->view->setConfiguration( [ 'publications' => [ '_descendAll' => [ '_only' => [ 'publishingDate', ], '_descend' => [ 'publishingDate' => [], ], ], ], ] ); } $this->view->assign('publications', $this->publicationRepository->findAll()); }
Actual:
[ { "publishingDate": { "offset": 0, "timestamp": 1631119140 } } ]
Expected:
[ { "publishingDate": "2021-09-08T16:39:00+00:00" } ]
Updated by Gerrit Code Review about 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/+/71347
Updated by Gerrit Code Review about 3 years ago
Patch set 2 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/+/71347
Updated by Gerrit Code Review about 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/+/71377
Updated by Anonymous about 3 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 6c07327fae82554d9a689eff5a007e5eb10a9781.