From 43c920cb44eb606bc8c16d2344ecec762a20ca21 Mon Sep 17 00:00:00 2001 From: Stefan Giehl Date: Thu, 28 Jan 2021 00:09:46 +0100 Subject: Fix timezone issue when using magic date keywords (#17144) * Fix timezone issue when using magic date keywords * improve readability * use Date::factoryInTimezone --- core/Period/Factory.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'core') diff --git a/core/Period/Factory.php b/core/Period/Factory.php index b316bebefa..7c804df611 100644 --- a/core/Period/Factory.php +++ b/core/Period/Factory.php @@ -168,10 +168,9 @@ abstract class Factory } else { if (!($date instanceof Date)) { if (preg_match('/^(now|today|yesterday|yesterdaySameTime|last[ -]?(?:week|month|year))$/i', $date)) { - $date = Date::factory($date, $timezone); - } else { - $date = Date::factory($date); + $date = Date::factoryInTimezone($date, $timezone); } + $date = Date::factory($date); } $oPeriod = Factory::build($period, $date); } -- cgit v1.2.3