You are here

public static function DateGranularity::sorted in Date 8

Sorts a granularity array.

Parameters

array $array: An array of date parts.

1 call to DateGranularity::sorted()
DateGranularity::precision in date_api/lib/Drupal/date_api/DateGranularity.php
Give a granularity array, return the highest precision.

File

date_api/lib/Drupal/date_api/DateGranularity.php, line 200
Definition of DateGranularity.

Class

DateGranularity
This class manages granularity. It can set granularity, get it from an array, get it from a format string, see if the array has any time or date elements, set and unset various granularity parts, create a nongranularity array of the granularity parts…

Namespace

Drupal\date_api

Code

public static function sorted($array) {
  return array_intersect(self::$granularity_parts, $array);
}