Implements hook_preprocess_HOOK() for comment.html.twig.
function olivero_preprocess_comment(&$variables) : void { // Getting the node creation time stamp from the comment object. $date = $variables['comment']->getCreatedTime(); // Formatting "created" as "X days ago". $variables['created'] = t('@time ago', [ '@time' => \Drupal::service('date.formatter')->formatInterval(\Drupal::time()->getRequestTime() - $date), ]); }