33 lines
640 B
Vue
33 lines
640 B
Vue
<template>
|
|
<time
|
|
:datetime="date"
|
|
:title="date | moment"
|
|
>
|
|
<i
|
|
v-if="icon"
|
|
class="outline clock icon"
|
|
/>
|
|
{{ realDate | ago($store.state.ui.momentLocale) }}
|
|
</time>
|
|
</template>
|
|
<script>
|
|
import { mapState } from 'vuex'
|
|
export default {
|
|
props: {
|
|
date: { type: String, default: '' },
|
|
icon: { type: Boolean, required: false, default: false }
|
|
},
|
|
computed: {
|
|
...mapState({
|
|
lastDate: state => state.ui.lastDate
|
|
}),
|
|
realDate () {
|
|
if (this.lastDate) {
|
|
// dummy code to trigger a recompute to update the ago render
|
|
}
|
|
return this.date
|
|
}
|
|
}
|
|
}
|
|
</script>
|