You are here

function date_views_date_range in Date 5

4 calls to date_views_date_range()
date_views_browser_navigation in ./date_views.inc
Navigation links for the full view
date_views_browser_period_start_stamp in ./date_views.inc
Find the timestamp for the beginning of the period of the analyzed date arg
_date_views_argument_range_handler in ./date_views.inc
_date_views_query_alter in ./date_views.inc
Implementation of hook_views_query() Used to make sure view defaults to current date if no date selected

File

./date_views.inc, line 374

Code

function date_views_date_range($arg, $field = NULL) {
  if (stristr($arg, 'P')) {

    // for a date plus value, get the min and max values
    $range = date_plus_period($arg);
    $min_date = $range[0];
    $max_date = $range[1];
  }
  elseif (stristr($arg, '-W') && !stristr($arg, '--')) {

    // for a specified week, get the min and max values
    $range = date_week_value($arg);
    $min_date = $range[0];
    $max_date = $range[1];
  }
  else {

    // for all other get the date range from the supplied argument
    $range = (array) explode('--', $arg);
    $min_date = date_range_value($range[0], 'min');
    $max_date = date_range_value($range[1] ? $range[1] : $range[0], 'max');
  }
  if (isset($field)) {
    $min_date = date_unset_granularity($min_date, date_granularity_array($field), $field['type']);
    $max_date = date_unset_granularity($max_date, date_granularity_array($field), $field['type']);
  }
  return array(
    $min_date,
    $max_date,
  );
}