How can I use xx time ago in Drupal 8 comments? I use Drupal 8 and want the date of comments just show "xx time ago".

I added this code to mytheme.theme, but it does not work:

function mytheme_preprocess_comment(&amp;$variables) { 
/** @var \Drupal\Core\Datetime\DateFormatterInterface $formatter */
$date_formatter = \Drupal::service('date.formatter');

$variables['foo'] = $date_formatter-&gt;formatDiff(REQUEST_TIME - 12345, REQUEST_TIME, [
'granularity' =&gt; 3,
'return_as_object' =&gt; TRUE,   ]); }


And I use {{ foo }} but that does not show "time ago" either. Other things I tried (and which didn't work either):


{{ created|date_modify }}
{{ created|time_deff }}
{{ created }}


Any help/hints about how I can do this?

Note: using the same logic as in my previous question (How can I use &#39;xx time ago&#39; as date format?) and using MYTHEME_preprocess_comment instead (as suggested by Neograph734) does not seem to work for comments.
Have a look at what is mentioned on "Formatting the way the date/time is displayed in Drupal 8". Here is a quote from it:


  You can change the date format for comment using template_preprocess_comment(). For example, normally in comments the comment created time is displayed like Thu, 12/17/2015 - 23:04. We can change the format to look like 3 weeks 5 Days ago.


And this is the sample code mentioned below it:

/**
* Implements hook_preprocess_comment
*/
function THEME_NAME_preprocess_comment(&amp;$variables) {
  // Getting the node creation time stamp from the comment object.
  $date = $variables['comment']-&gt;getCreatedTime();
  // Here you can use drupal's format_date() function, or some custom php date formatting.
  $variables['created'] = \Drupal::service('date.formatter')-&gt;formatInterval(REQUEST_TIME - $date);
  $variables['submitted'] = t('@username commented !datetime', array('@username' =&gt; $variables['author'], '!datetime' =&gt; '&lt;span class="comments-ago"&gt;' . $variables['created'] . ' ago &lt;/span&gt;'));
}


I haven't tested this code (yet), but it looks pretty close to what you're asking for ...