1 date_sql_handler.inc date_sql_handler::arg_granularity($arg)

Granularity arguments handler.

Use the parsed values from the ISO argument to determine the granularity of this period.

File

core/modules/date/views/date_sql_handler.inc, line 830
SQL helper for Date API.

Class

date_sql_handler
A class to manipulate date SQL.

Code

function arg_granularity($arg) {
  $granularity = '';
  $parts = $this->arg_parts($arg);
  $date = !empty($parts[0]['date']) ? $parts[0]['date'] : (!empty($parts[1]['date']) ? $parts[1]['date'] : array());
  foreach ($date as $key => $part) {
    $granularity = $key;
  }
  return $granularity;
}