Bug #66793
closedEpic #77562: Misbehaviors with datetime values and timezones
"simulate time" in admin-panel does not respect timezone
100%
Description
The entered time in the text field "simulate time" is evaluated as UTC / GMT even though a different timezone is set on client + server machine (CEST / "Europe/Berlin").
This problem exists in 4.5.40 and 6.2.12.
More info:¶
php.ini:
date.timezone = "Europe/Berlin"
System timezone: CEST
LocalConfiguration.php:
'phpTimeZone' => 'Europe/Berlin',
'serverTimeZone' => '2',
reproduce¶
- Set allowed time from 9:00 to 10:00 for a page (e.g. 9:00 5-5-2015)
- Enter 7:18 in "simulate time" in admin panel
Result¶
Allowed content (9:00 to 10:00) is displayed for entered time of 7:18 > not correct
conclusion:¶
"simulate time" in admin-panel is evaluated as UTC (it does not use current timezone)
Test¶
entered time for content: 6:00 - 9:00
entered time in "simulate time" in admin panel:
3:00 : content not visible
4:00 : content visisble
5:00 : content visible
6:00 : content visible
6:59 : content visisble
7:00 : content not visisble
+2 hours offset
Updated by Tizian Schmidlin about 8 years ago
- Priority changed from Should have to Must have
Can absolutely reproduce on 100% of our servers.
Here's how I'd patch it:
TYPO3 6.2
File: typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
Line: 1339
From
$simTime = $GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview', 'simulateDate');
To
$simTime = $GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview', 'simulateDate') - date('Z', $GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview', 'simulateDate'));
This would solve the issue.
Regards
Tizian
EDIT: Patch:
Date: Thu, 15 Sep 2016 13:54:40 +0200 Subject: [PATCH] Fixed simulate date that is off by the timezone --- .../frontend/Classes/Controller/TypoScriptFrontendController.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/typo3_src-6.2.19/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3_src-6.2.19/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php index 8129870..bcc2a7f 100644 --- a/typo3_src-6.2.19/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php +++ b/typo3_src-6.2.19/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php @@ -1336,8 +1336,7 @@ class TypoScriptFrontendController { $this->showHiddenPage = (bool)$GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview', 'showHiddenPages'); $this->showHiddenRecords = (bool)$GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview', 'showHiddenRecords'); // Simulate date - $simTime = $GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview', 'simulateDate'); + $simTime = $GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview', 'simulateDate') - date('Z', $GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview', 'simulateDate')); if ($simTime) { $GLOBALS['SIM_EXEC_TIME'] = $simTime; $GLOBALS['SIM_ACCESS_TIME'] = $simTime - $simTime % 60; } -- 1.9.1
Updated by Mona Muzaffar over 7 years ago
- Related to Epic #80852: Datetime handling in backend added
Updated by Riccardo De Contardi over 7 years ago
- Related to Bug #27919: Preview in Admin Panel does not handle Timezone correctly added
Updated by Riccardo De Contardi over 7 years ago
- Related to deleted (Epic #80852: Datetime handling in backend)
Updated by Riccardo De Contardi over 6 years ago
- Related to Epic #84044: Admin Panel Rework added
Updated by Sybille Peters over 6 years ago
- Priority changed from Must have to Should have
Updated by Sybille Peters over 6 years ago
- Related to Feature #85021: Add hint for entering date/time in "simulate time" text field in admin panel added
Updated by Tizian Schmidlin over 6 years ago
Can we expect a bugfix in current LTS versions or should we rely on self-patching?
Updated by Sybille Peters over 6 years ago
A coredev would have to answer that.
However, unofficially, if it really is a minor change with no side-effects (looks like it from what you wrote), we might be able to get it merged in (for 8.x) if someone uploads a patch.
Since you already did the research, do you want to do that?
I am not sure, if you contributed to the core yet.
Look at the contribution guide for a tutorial: https://docs.typo3.org/typo3cms/ContributionWorkflowGuide/
If your fix still works, but core contribution is too much hassle for you right now, let me know. I might be able to help (meaning I can upload the patch or answer questions).
Hint: If you get stuck anywhere, ask on Slack in the #typo3-cms-coredev channel. You can register in the TYPO3 slack workspace here: https://forger.typo3.com/slack
Updated by Sybille Peters over 6 years ago
Ok, the code for 9.x is now in a sysext 'adminpanel', for 8.x it's not.
Updated by Tizian Schmidlin over 6 years ago
I'll make a PR for this to happen in 8.7 too
Updated by Gerrit Code Review over 6 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/57079
Updated by Gerrit Code Review over 6 years ago
Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57080
Updated by Gerrit Code Review over 6 years ago
Patch set 2 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57080
Updated by Gerrit Code Review over 6 years ago
Patch set 3 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57080
Updated by Tizian Schmidlin over 6 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset ec512770c63a74aed6abac7c02ca7b6ad6b21e9e.
Updated by Sybille Peters over 6 years ago
Fixed for TYPO3 8.
For 9, the adminpanel is currently being refactored. I can't open it in TYPO3 version 9 latest master at all so can't test if the bug reappears in 9. Let's assume, all is good.
Updated by Susanne Moog over 6 years ago
- Related to Feature #84584: Re-Design the admin panel added