function Date::getTimezone

Same name in other branches
  1. 9 core/modules/datetime/src/Plugin/views/filter/Date.php \Drupal\datetime\Plugin\views\filter\Date::getTimezone()
  2. 8.9.x core/modules/datetime/src/Plugin/views/filter/Date.php \Drupal\datetime\Plugin\views\filter\Date::getTimezone()
  3. 11.x core/modules/datetime/src/Plugin/views/filter/Date.php \Drupal\datetime\Plugin\views\filter\Date::getTimezone()

Get the proper time zone to use in computations.

Date-only fields do not have a time zone associated with them, so the filter input needs to use UTC for reference. Otherwise, use the time zone for the current user.

Return value

string The time zone name.

2 calls to Date::getTimezone()
Date::opBetween in core/modules/datetime/src/Plugin/views/filter/Date.php
Override parent method, which deals with dates as integers.
Date::opSimple in core/modules/datetime/src/Plugin/views/filter/Date.php
Override parent method, which deals with dates as integers.

File

core/modules/datetime/src/Plugin/views/filter/Date.php, line 151

Class

Date
Date/time views filter.

Namespace

Drupal\datetime\Plugin\views\filter

Code

protected function getTimezone() {
    return $this->dateFormat === DateTimeItemInterface::DATE_STORAGE_FORMAT ? DateTimeItemInterface::STORAGE_TIMEZONE : date_default_timezone_get();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.