Skip to content
Snippets Groups Projects
Commit 151e93b2 authored by Jonathan Sacksick's avatar Jonathan Sacksick
Browse files

Issue #3023795 by heddn: Timezone adjustments are not accounted for in ReportDateField.

parent 1ce96e03
Branches 8.x-1.x
No related merge requests found
Pipeline #414537 passed with warnings
......@@ -118,9 +118,13 @@ class ReportDateField extends EntityField {
$this->add_field_table($use_groupby);
$this->ensureMyTable();
// Add the field.
// Add the field with timezone offset.
$params = $this->options['group_type'] !== 'group' ? ['function' => $this->options['group_type']] : [];
$expression = $this->query->getDateFormat("FROM_UNIXTIME($this->tableAlias.$this->realField)", $this->dateFormatString);
$offset = '';
$this->query->setFieldTimezoneOffset($offset, $this->query->getTimezoneOffset());
$offset = trim($offset, '()');
$expression = $this->query->getDateFormat("FROM_UNIXTIME($this->tableAlias.$this->realField) $offset", $this->dateFormatString);
$this->field_alias = $this->query->addField(NULL, $expression, "{$this->tableAlias}_{$this->realField}", $params);
$this->query->addGroupBy($this->field_alias);
$this->aliases[$this->definition['field_name']] = $this->field_alias;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment