Bug #44997
JsonView outputs unreliable DateTime representation
Status: | Resolved | Start date: | 2013-01-31 | |
---|---|---|---|---|
Priority: | Must have | Due date: | ||
Assigned To: | Adrian Föder | % Done: | 100% |
|
Category: | MVC | |||
Target version: | TYPO3 Flow Base Distribution - 2.0 | |||
PHP Version: | 5.3 | Complexity: | ||
Has patch: | Yes | Affected Flow version: | FLOW3 1.0.0 |
Description
Currently, the JsonView just outputs Y-m-d H:i:s
as string when it comes to a DateTime object. This is incorrect since it doesn't care about time zones / offsets.
- it's 15:13 GMT, a record is created
- the record is stored in 14:13 UTC
- after Hydration, the DateTime object represents 14:13 UTC
- JsonView's H:i:s makes "14:13" of it
- (maybe) the string is directly given to JavaScript's new Date() constructor, resulting (due to GMT local time) in 14:13 GMT which is obviously wrong.
Solution: add a timezone offset as in ISO 8601 which is also directly accepted by JavaScript's Date() constructor and probably any other "magical" datetime parser.
Associated revisions
[!!!][BUGFIX] Expose timezone in JsonView's DateTime output
This corrects the string formatting in JsonView regarding
DateTime objects. The additionally required Timezone offset
is appended as of ISO 8601 in order to not lead into timezone
issues after transferring the resulting JSON.
This is breaking in cases where the original incorrect behaviour
was worked around by subsequent processing of the transmitted
timestamp.
Fixes: #44997
Releases: master, 2.0
Change-Id: Ia26d68945dd6deae9438de7ba71dee67cff4626d
[!!!][BUGFIX] Expose timezone in JsonView's DateTime output
This corrects the string formatting in JsonView regarding
DateTime objects. The additionally required Timezone offset
is appended as of ISO 8601 in order to not lead into timezone
issues after transferring the resulting JSON.
This is breaking in cases where the original incorrect behaviour
was worked around by subsequent processing of the transmitted
timestamp.
Fixes: #44997
Releases: master, 2.0
Change-Id: Ia26d68945dd6deae9438de7ba71dee67cff4626d
History
#1 Updated by Gerrit Code Review over 2 years ago
- Status changed from New to Under Review
Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/17789
#2 Updated by Gerrit Code Review over 2 years ago
Patch set 1 for branch 2.0 has been pushed to the review server.
It is available at https://review.typo3.org/19089
#3 Updated by Adrian Föder over 2 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset dfb87c1373ced4d18c0fe4cd8999820639366b82.