I'm using one of the automatic timeago plugin called Livestamp.js (http://mattbradley.github.io/livestampjs/). It seems to collaborate with moment.js to automatically convert this:
<span data-livestamp="1488615741"></span>
to this:
<span>8 minutes ago</span>
in every time interval.
But I don't like that because the glitch will be observable in few miliseconds before the <span>
finally automatically converted. Because of that, I want to do it manually via jQuery, so if I done .append()
, I want the <span>
to converted immediately.
I have tried to do this
$('div').append(data).promise().done(function() {
$(this).find('span[data-livestamp]').livestamp($(this).data('livestamp'));
});
But it not work. The <span>
is indeed converted immediately, but "a few seconds ago", while actually it's 6 days ago.
How to accomplish this?
Update changed the code to be more simple to understand.