function Date::opBetween
Same name in this branch
- 10 core/modules/datetime/src/Plugin/views/filter/Date.php \Drupal\datetime\Plugin\views\filter\Date::opBetween()
Same name in other branches
- 9 core/modules/views/src/Plugin/views/filter/Date.php \Drupal\views\Plugin\views\filter\Date::opBetween()
- 9 core/modules/datetime/src/Plugin/views/filter/Date.php \Drupal\datetime\Plugin\views\filter\Date::opBetween()
- 8.9.x core/modules/views/src/Plugin/views/filter/Date.php \Drupal\views\Plugin\views\filter\Date::opBetween()
- 8.9.x core/modules/datetime/src/Plugin/views/filter/Date.php \Drupal\datetime\Plugin\views\filter\Date::opBetween()
- 11.x core/modules/views/src/Plugin/views/filter/Date.php \Drupal\views\Plugin\views\filter\Date::opBetween()
- 11.x core/modules/datetime/src/Plugin/views/filter/Date.php \Drupal\datetime\Plugin\views\filter\Date::opBetween()
Overrides NumericFilter::opBetween
1 method overrides Date::opBetween()
- Date::opBetween in core/
modules/ datetime/ src/ Plugin/ views/ filter/ Date.php - Override parent method, which deals with dates as integers.
File
-
core/
modules/ views/ src/ Plugin/ views/ filter/ Date.php, line 168
Class
- Date
- Filter to handle dates stored as a timestamp.
Namespace
Drupal\views\Plugin\views\filterCode
protected function opBetween($field) {
$a = intval(strtotime($this->value['min'], 0));
$b = intval(strtotime($this->value['max'], 0));
if ($this->value['type'] == 'offset') {
// Keep sign.
$a = '***CURRENT_TIME***' . sprintf('%+d', $a);
// Keep sign.
$b = '***CURRENT_TIME***' . sprintf('%+d', $b);
}
// This is safe because we are manually scrubbing the values.
// It is necessary to do it this way because $a and $b are formulas when using an offset.
$operator = strtoupper($this->operator);
$this->query
->addWhereExpression($this->options['group'], "{$field} {$operator} {$a} AND {$b}");
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.