protected function DateTimeTimeAgoFormatter::formatDate in Drupal 10
Same name and namespace in other branches
- 8 core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeTimeAgoFormatter.php \Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeTimeAgoFormatter::formatDate()
- 9 core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeTimeAgoFormatter.php \Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeTimeAgoFormatter::formatDate()
Formats a date/time as a time interval.
Parameters
\Drupal\Core\Datetime\DrupalDateTime|object $date: A date/time object.
Return value
array The formatted date/time string using the past or future format setting.
1 call to DateTimeTimeAgoFormatter::formatDate()
- DateTimeTimeAgoFormatter::viewElements in core/
modules/ datetime/ src/ Plugin/ Field/ FieldFormatter/ DateTimeTimeAgoFormatter.php - Builds a renderable array for a field value.
File
- core/
modules/ datetime/ src/ Plugin/ Field/ FieldFormatter/ DateTimeTimeAgoFormatter.php, line 49
Class
- DateTimeTimeAgoFormatter
- Plugin implementation of the 'Time ago' formatter for 'datetime' fields.
Namespace
Drupal\datetime\Plugin\Field\FieldFormatterCode
protected function formatDate(DrupalDateTime $date) {
return parent::formatTimestamp($date
->getTimestamp());
}