JSFiddle - React, Tailwind, and code Playground

HTML

<div class="message" id='1' data-timestamp='1345888475'>
<span class="content"># Hi what are you doing? </span><br/>
<span class="timeAgo">5 mint ago. </span>
</div>
<div class="message" id='1' data-timestamp='1345888855'>
<span class="content"># Akon song is good ? </span><br/>
<span class="timeAgo">5 mint ago. </span>
</div>
<div class="message" id='1' data-timestamp=''>
<span class="content"># I love the way you lie? </span><br/>
<span class="timeAgo">5 mint ago. </span>
</div>

JavaScript

//you should get the time from the server.
//var currentTime = <?=time()?>;
// used just for this test
var currentTime = Math.round((new Date()).getTime() / 1000);

var timestampHandler = setInterval(onUpdateTimestamp, 60 * 1000); //one minute

function onUpdateTimestamp(){
     currentTime += 60;
     $(".message").each(updateTimeAgo);
}

function updateTimeAgo(){
    var $el = $(this);
    var postTime = parseInt($el.data('timestamp'));
    var newTimeAgo = Math.round((currentTime - postTime) / 60); //minutes
    $el.find(".timeAgo").html(newTimeAgo + " mint ago.")
}

onUpdateTimestamp()