You are here

protected function Date::getTimezone in Drupal 9

Same name and namespace in other branches
  1. 8 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();
}