public function FacetsDateHandler::formatDate in Facets 8
Returns a formatted date based on the passed ISO date string and gap.
Parameters
string $date: A string containing the date as an ISO date string.
int $gap: An integer containing the gap, see FACETS_DATE_* constants for valid values, defaults to YEAR.
string $callback: The formatting callback, defaults to "FACETS_format_timestamp". This is a string that can be called as a valid callback.
Return value
string A gap-appropriate display date used in the facet link.
See also
FACETS_format_timestamp()
File
- src/
Utility/ FacetsDateHandler.php, line 302
Class
- FacetsDateHandler
- Dates Handler service.
Namespace
Drupal\facets\UtilityCode
public function formatDate($date, $gap = self::FACETS_DATE_YEAR, $callback = 'facets_format_timestamp') {
$timestamp = strtotime($date);
return $callback($timestamp, $gap);
}