protected function Date::opSimple

Overrides Numeric::opSimple

File

drupal/core/modules/views/lib/Drupal/views/Plugin/views/filter/Date.php, line 181
Definition of Drupal\views\Plugin\views\filter\Date.

Class

Date
Filter to handle dates stored as a timestamp.

Namespace

Drupal\views\Plugin\views\filter

Code

protected function opSimple($field) {
  $value = intval(strtotime($this->value['value'], 0));
  if (!empty($this->value['type']) && $this->value['type'] == 'offset') {
    $value = '***CURRENT_TIME***' . sprintf('%+d', $value);

    // keep sign
  }

  // This is safe because we are manually scrubbing the value.
  // It is necessary to do it this way because $value is a formula when using an offset.
  $this->query
    ->add_where_expression($this->options['group'], "{$field} {$this->operator} {$value}");
}