public function FacetsDateHandler::getDateGap in Facets 8
Converts ISO date strings to Unix timestamps.
Passes values to the FACETS_get_timestamp_gap() function to calculate the gap.
Parameters
string $start_date: A string containing the start date as an ISO date string.
string $end_date: A string containing the end date as an ISO date string.
string|null $min_gap: (Optional) The minimum gap that should be returned.
Return value
string A string containing the gap, see FACETS_DATE_* constants for valid values. Returns FALSE of either of the dates cannot be converted to a timestamp.
See also
FACETS_get_timestamp_gap()
File
- src/
Utility/ FacetsDateHandler.php, line 238  
Class
- FacetsDateHandler
 - Dates Handler service.
 
Namespace
Drupal\facets\UtilityCode
public function getDateGap($start_date, $end_date, $min_gap = NULL) {
  $range = [
    strtotime($start_date),
    strtotime($end_date),
  ];
  if (!in_array(FALSE, $range, TRUE)) {
    return $this
      ->getTimestampGap($range[0], $range[1], $min_gap);
  }
  return FALSE;
}