Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the user timezone before comparing data #2011

Merged
merged 1 commit into from
Jul 12, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions app/bundles/CoreBundle/Helper/Chart/ChartQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ public function applyDateFilters(&$query, $dateColumn, $tablePrefix = 't')
// Check if the date filters have already been applied
if ($parameters = $query->getParameters()) {
if (array_key_exists('dateTo', $parameters) || array_key_exists('dateFrom', $parameters)) {

return;
}
}
Expand Down Expand Up @@ -156,7 +155,6 @@ public function applyDateFilters(&$query, $dateColumn, $tablePrefix = 't')
$query->setParameter('dateTo', $dateTo->format('Y-m-d H:i:s'));
}
}

}
}

Expand Down Expand Up @@ -306,6 +304,7 @@ public function completeTimeData($rawData, $countAverage = false)

// Data from the database will always in UTC
$itemDate = new \DateTime($item['date'], $utcTz);
$itemDate->setTimezone($previousDate->getTimezone());

if (!in_array($this->unit, array('H', 'i', 's'))) {
// Hours do not matter so let's reset to 00:00:00 for date comparison
Expand Down