You are here

function date_views_filter_handler_simple::year_range in Date 8

Same name and namespace in other branches
  1. 7.3 date_views/includes/date_views_filter_handler_simple.inc \date_views_filter_handler_simple::year_range()
  2. 7.2 date_views/includes/date_views_filter_handler_simple.inc \date_views_filter_handler_simple::year_range()

File

date_views/includes/date_views_filter_handler_simple.inc, line 188
A standard Views filter for a single date field, using Date API form selectors and sql handling.

Class

date_views_filter_handler_simple

Code

function year_range() {
  $year_range = explode(':', $this->options['year_range']);
  if (substr($this->options['year_range'], 0, 1) == '-' || $year_range[0] < 0) {
    $this_year = date_format(new DrupalDateTime(), 'Y');
    $year_range[0] = $this_year + $year_range[0];
    $year_range[1] = $this_year + $year_range[1];
  }
  return $year_range;
}