You are here

function facetapi_callback_date_map in Facet API 6

Converts date ranges to human readable dates.

Parameters

$ranges: An array containing the date ranges.

Return value

An array mapping the ranges to nice display dates.

1 string reference to 'facetapi_callback_date_map'
facetapi_facetapi_facet_info in ./facetapi.module
Implementation of hook_facetapi_facet_info().

File

./facetapi.callbacks.inc, line 99
Various callbacks referenced in facet definitions.

Code

function facetapi_callback_date_map(array $ranges) {
  $map = array();
  foreach ($ranges as $value) {
    $range = explode(' TO ', trim($value, '{[]}'));
    if (2 == count($range)) {
      $gap = facetapi_date_gap_get($range[0], $range[1]);
      $map[$value] = facetapi_date_format($range[0], $gap);
    }
  }
  return $map;
}