protected function DevelController::showTimeAndTimeAgo in Search API Solr 8
Given a timestamp it returns both a human-readable date + "time ago"
Parameters
$timestamp:
Return value
\Drupal\Core\StringTranslation\TranslatableMarkup
2 calls to DevelController::showTimeAndTimeAgo()
- DevelController::entitySolr in src/
Controller/ DevelController.php - Prints the document structure to be indexed by Solr.
- DevelController::getBaseRow in src/
Controller/ DevelController.php - Return a base row for the summary table, which will be modified later on.
File
- src/
Controller/ DevelController.php, line 280
Class
- DevelController
- Returns responses for devel module routes.
Namespace
Drupal\search_api_solr\ControllerCode
protected function showTimeAndTimeAgo($timestamp) {
return $this
->t('%time (%time_ago ago)', [
'%time' => \Drupal::service('date.formatter')
->format($timestamp),
'%time_ago' => \Drupal::service('date.formatter')
->formatDiff($timestamp, \Drupal::time()
->getRequestTime()),
]);
}