Issue Bug Closed

#101171EXT:belog ignores timezone in filter

Jonas Renggli 06/26/23, 19:14 updated 12/02/25, 14:33

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.

2023-06-26-belog.png

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

Reviews 3

Files 1

History 717

  1. Jonas Renggli commented <span data-processor="relativetime" data-value="2023-06-26T19:31:45+00:00" > 06/26/23, 19:31 </span>

    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);
        }
  2. Benjamin Franzke commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2025-03-31T14:20:10+00:00" > 03/31/25, 14:20 </span>

    Applied in changeset commit:e8e082fd897f31b59b37d6bed301f90aaeb98332.