Vue momentjs update relative time in real time

Posted 5 months ago by Dronax

How I can do update relative time from momentjs in real time for user?

I have computed:

computed: {
ago() {
  return moment().fromNow();

And when I use in component this:

<span class="text-muted pr-2" v-text="ago"></span>

I get static text: a few seconds ago, how update this text without page reloading? I want see: a two seconds ago, a minute ago, a two minutes ago e.t.c..

How I can do this in real time for user?

Please sign in or create an account to participate in this conversation.