Bug #66793

Epic #77562: Misbehaviors with datetime values and timezones

"simulate time" in admin-panel does not respect timezone

Added by Sybille Peters about 6 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2015-05-05
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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

  1. Set allowed time from 9:00 to 10:00 for a page (e.g. 9:00 5-5-2015)
  2. 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


Related issues

Related to TYPO3 Core - Feature #80559: datetime and time handling should always have timezone informationClosed2017-03-29

Actions
Related to TYPO3 Core - Bug #27919: Preview in Admin Panel does not handle Timezone correctlyClosed2011-07-06

Actions
Related to TYPO3 Core - Epic #84044: Admin Panel ReworkClosedSusanne Moog2010-08-11

Actions
Related to TYPO3 Core - Feature #85021: Add hint for entering date/time in "simulate time" text field in admin panelClosed2018-05-16

Actions
Related to TYPO3 Core - Feature #84584: Re-Design the admin panelClosedSusanne Moog2018-04-03

Actions
#1

Updated by Tizian Schmidlin over 4 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
#2

Updated by Mona Muzaffar about 4 years ago

  • Related to Epic #80852: Datetime handling in backend added
#3

Updated by Riccardo De Contardi about 4 years ago

  • Related to Bug #27919: Preview in Admin Panel does not handle Timezone correctly added
#4

Updated by Markus Klein almost 4 years ago

  • Parent task set to #77562
#5

Updated by Riccardo De Contardi almost 4 years ago

  • Related to deleted (Epic #80852: Datetime handling in backend)
#6

Updated by Sybille Peters over 3 years ago

  • Description updated (diff)
#7

Updated by Riccardo De Contardi about 3 years ago

#8

Updated by Sybille Peters about 3 years ago

  • Priority changed from Must have to Should have
#9

Updated by Sybille Peters about 3 years ago

  • Related to Feature #85021: Add hint for entering date/time in "simulate time" text field in admin panel added
#10

Updated by Tizian Schmidlin almost 3 years ago

Can we expect a bugfix in current LTS versions or should we rely on self-patching?

#11

Updated by Sybille Peters almost 3 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

#12

Updated by Sybille Peters almost 3 years ago

Ok, the code for 9.x is now in a sysext 'adminpanel', for 8.x it's not.

#13

Updated by Tizian Schmidlin almost 3 years ago

I'll make a PR for this to happen in 8.7 too

#14

Updated by Gerrit Code Review almost 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/57079

#15

Updated by Gerrit Code Review almost 3 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

#16

Updated by Gerrit Code Review almost 3 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

#17

Updated by Gerrit Code Review almost 3 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

#18

Updated by Tizian Schmidlin almost 3 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#19

Updated by Sybille Peters almost 3 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.

#20

Updated by Susanne Moog almost 3 years ago

#21

Updated by Benni Mack over 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF