Project

General

Profile

Actions

Bug #101171

closed

Epic #77562: Misbehaviors with datetime values and timezones

EXT:belog ignores timezone in filter

Added by Jonas Renggli almost 2 years ago. Updated 3 months ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
Backend User Interface
Target version:
-
Start date:
2023-06-26
Due date:
% Done:

100%

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

Description

Actual Result

The dates in the list correctly respect the current timezone. However, the filter does not. When applying a time range filter, the list displays entries outside of that specified range. For example, when filtering from 18:00 to 19:00, the log entries shown are from 20:48.

Expected Result

The log entries shown should correspond to the date range configured in the filter.

Steps to reproduce

A short script to speed things up ;-)

ddev config  --project-type=typo3 --docroot=public --create-docroot --php-version=8.1 --timezone=Europe/Zurich
ddev start
ddev composer create "typo3/cms-base-distribution:^12" 
ddev exec ./vendor/bin/typo3 setup
ddev launch

Environment

Tested both with TYPO3 11 and 12


Files

2023-06-26-belog.png (38.4 KB) 2023-06-26-belog.png Jonas Renggli, 2023-06-26 19:23

Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Feature #61110: Support for timezones in all date fields in TYPO3 BEAccepted2014-08-21

Actions
Actions #1

Updated by Jonas Renggli almost 2 years ago

  • File deleted (Bildschirmfoto 2023-06-26 um 20.54.15.png)
Actions #2

Updated by Jonas Renggli almost 2 years ago

Actions #3

Updated by Jonas Renggli almost 2 years ago

I don't know the exact functionality of this extension and the interaction with the component flatpickr.js.

In my opinion, the most pragmatic way would be to consider the timezone just before accessing the persistence in BackendLogController::setStartAndEndTimeFromTimeSelector(). The following code is quick and dirty but achieves the expected result:

    protected function setStartAndEndTimeFromTimeSelector(Constraint $constraint)
    {
        $timezone = new \DateTimeZone(date_default_timezone_get());
        $startTime = $constraint->getManualDateStart()
            ? (new \DateTime(
                $constraint->getManualDateStart()->format('Y-m-d H:i:s'),
                $timezone
            ))->getTimestamp()
            : 0;
        $endTime = $constraint->getManualDateStop()
            ? (new \DateTime(
                $constraint->getManualDateStop()->format('Y-m-d H:i:s'),
                $timezone
            ))->getTimestamp()
            : 0;
        if ($endTime <= $startTime) {
            $endTime = $GLOBALS['EXEC_TIME'];
        }
        $constraint->setStartTimestamp($startTime);
        $constraint->setEndTimestamp($endTime);
    }
Actions #4

Updated by Georg Ringer 11 months ago

  • Related to Feature #61110: Support for timezones in all date fields in TYPO3 BE added
Actions #5

Updated by Gerrit Code Review 3 months ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/88796

Actions #6

Updated by Gerrit Code Review 3 months ago

Patch set 1 for branch 13.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/+/88801

Actions #7

Updated by Gerrit Code Review 3 months ago

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/88796

Actions #8

Updated by Benjamin Franzke 3 months ago

  • Parent task set to #77562
Actions #9

Updated by Gerrit Code Review 3 months ago

Patch set 1 for branch 12.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/+/88816

Actions #10

Updated by Gerrit Code Review 3 months ago

Patch set 2 for branch 12.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/+/88816

Actions #11

Updated by Gerrit Code Review 3 months ago

Patch set 2 for branch 13.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/+/88801

Actions #12

Updated by Gerrit Code Review 3 months ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/88796

Actions #13

Updated by Gerrit Code Review 3 months ago

Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/88796

Actions #14

Updated by Gerrit Code Review 3 months ago

Patch set 3 for branch 13.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/+/88801

Actions #15

Updated by Gerrit Code Review 3 months ago

Patch set 4 for branch 13.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/+/88801

Actions #16

Updated by Benjamin Franzke 3 months ago

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

Also available in: Atom PDF