1π
β
I havenβt tested this, but is should be something like this.
<td>
<span class="badge badge-warning">{{user.last_online_at}}</span>
</td>
<td>
<span v-if="getOnlineStatus(user.last_online_at)" class="badge badge-success">Online</span>
<span v-else class="badge badge-danger">Offline</span>
</td>
methods: {
...someMethods,
getOnlineStatus(testDate) {
var myDate = new Date(testDate);
var now = new Date();
let FIVE_MINS = 60 * 5;
return ((now - myDate) < FIVE_MINS);
}
}
π€bassxzero
Source:stackexchange.com