function Date::opSimple
Same name in this branch
- 10 core/modules/views/src/Plugin/views/filter/Date.php \Drupal\views\Plugin\views\filter\Date::opSimple()
Same name in other branches
- 9 core/modules/views/src/Plugin/views/filter/Date.php \Drupal\views\Plugin\views\filter\Date::opSimple()
- 9 core/modules/datetime/src/Plugin/views/filter/Date.php \Drupal\datetime\Plugin\views\filter\Date::opSimple()
- 8.9.x core/modules/views/src/Plugin/views/filter/Date.php \Drupal\views\Plugin\views\filter\Date::opSimple()
- 8.9.x core/modules/datetime/src/Plugin/views/filter/Date.php \Drupal\datetime\Plugin\views\filter\Date::opSimple()
- 11.x core/modules/views/src/Plugin/views/filter/Date.php \Drupal\views\Plugin\views\filter\Date::opSimple()
- 11.x core/modules/datetime/src/Plugin/views/filter/Date.php \Drupal\datetime\Plugin\views\filter\Date::opSimple()
Override parent method, which deals with dates as integers.
Overrides Date::opSimple
File
-
core/
modules/ datetime/ src/ Plugin/ views/ filter/ Date.php, line 128
Class
- Date
- Date/time views filter.
Namespace
Drupal\datetime\Plugin\views\filterCode
protected function opSimple($field) {
$timezone = $this->getTimezone();
$origin_offset = $this->getOffset($this->value['value'], $timezone);
// Convert to ISO. UTC timezone is used since dates are stored in UTC.
$value = new DateTimePlus($this->value['value'], new \DateTimeZone($timezone));
$value = $this->query
->getDateFormat($this->query
->getDateField("'" . $this->dateFormatter
->format($value->getTimestamp() + $origin_offset, 'custom', DateTimeItemInterface::DATETIME_STORAGE_FORMAT, DateTimeItemInterface::STORAGE_TIMEZONE) . "'", TRUE, $this->calculateOffset), $this->dateFormat, TRUE);
// This is safe because we are manually scrubbing the value.
$field = $this->query
->getDateFormat($this->query
->getDateField($field, TRUE, $this->calculateOffset), $this->dateFormat, TRUE);
$this->query
->addWhereExpression($this->options['group'], "{$field} {$this->operator} {$value}");
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.