Skip to content
Snippets Groups Projects
Commit fd21b441 authored by Anthony Cooper's avatar Anthony Cooper Committed by Anthony Cooper
Browse files

Default timezone check

parent 9b3177af
Branches
Tags
1 merge request!1Query based on user's timezone
......@@ -75,8 +75,13 @@ class FuturePastDate extends Date {
// .
$this->ensureMyTable();
// Calculate the user's timezone offset.
$timezone = new \DateTimeZone($this->account->getTimeZone());
// Calculate the user's timezone offset. Default to UTC.
if($this->account->getTimeZone()) {
$timezone = new \DateTimeZone($this->account->getTimeZone());
} else {
$timezone = new \DateTimeZone('UTC');
}
$offset = $timezone->getOffset(new \DateTime());
$date_alias = "UNIX_TIMESTAMP($this->tableAlias.$this->realField) - $offset";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment