From 31c97cfd205cfe3b54b2e1b0657e56c4532222cc Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@enhancesoft.com> Date: Thu, 14 Nov 2019 15:55:20 +0000 Subject: [PATCH] Remove user's timezone conversion The date picker already has the user's timezone factored in to the selection. Removing user's timezone allows for admin set queues to maintain the original timezone selection. --- include/class.forms.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/class.forms.php b/include/class.forms.php index f74f69789..484be2059 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -2415,14 +2415,15 @@ class DatetimeField extends FormField { case 'before': return new Q(array("{$name}__lt" => $value)); case 'between': - $tz = new DateTimeZone($cfg->getTimezone()); - $dbtz = new DateTimeZone($cfg->getDbTimezone()); $left = Format::parseDateTime($value['left']); $right = Format::parseDateTime($value['right']); + // TODO: allow time selection for between $left = $left->setTime(00, 00, 00); $right = $right->setTime(23, 59, 59); - $left->setTimezone($tz)->setTimezone($dbtz); - $right->setTimezone($tz)->setTimezone($dbtz); + // Convert time to db timezone + $dbtz = new DateTimeZone($cfg->getDbTimezone()); + $left->setTimezone($dbtz); + $right->setTimezone($dbtz); return new Q(array( "{$name}__gte" => $left->format('Y-m-d H:i:s'), "{$name}__lte" => $right->format('Y-m-d H:i:s'), -- GitLab