You are here

function DateSqlHandler::arg_granularity in Date 8

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

File

date_api/lib/Drupal/date_api/DateSqlHandler.php, line 1013

Class

DateSqlHandler
A class to manipulate date SQL.

Namespace

Drupal\date_api

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;
}