public function MysqlDate::opBetween in Views Custom Table 8
Same name and namespace in other branches
- 9.0.x src/Plugin/views/filter/MysqlDate.php \Drupal\view_custom_table\Plugin\views\filter\MysqlDate::opBetween()
Filters by operator between.
Parameters
object $field: The views field.
Overrides Date::opBetween
File
- src/
Plugin/ views/ filter/ MysqlDate.php, line 70
Class
- MysqlDate
- Filter to handle dates stored as a datetime.
Namespace
Drupal\view_custom_table\Plugin\views\filterCode
public function opBetween($field) {
$a = intval(strtotime($this->value['min'], $this->time
->getRequestTime()));
$a = $this->dateFormatter
->format($a, 'custom', 'Y-m-d');
$b = intval(strtotime($this->value['max'], $this->time
->getRequestTime()));
$b = $this->dateFormatter
->format($b, 'custom', 'Y-m-d');
$this->query
->addWhere($this->options['group'], $field, [
$a,
$b,
], $this->operator);
}