use Timeago for timestamps
This commit is contained in:
parent
298e0af99e
commit
9fc7991808
2 changed files with 12 additions and 10 deletions
|
|
@ -13,6 +13,7 @@ import StatusContent from 'src/components/status_content/status_content.vue'
|
||||||
import StatusPopover from 'src/components/status_popover/status_popover.vue'
|
import StatusPopover from 'src/components/status_popover/status_popover.vue'
|
||||||
import UserAvatar from 'src/components/user_avatar/user_avatar.vue'
|
import UserAvatar from 'src/components/user_avatar/user_avatar.vue'
|
||||||
import UserPopover from 'src/components/user_popover/user_popover.vue'
|
import UserPopover from 'src/components/user_popover/user_popover.vue'
|
||||||
|
import Timeago from 'src/components/timeago/timeago.vue'
|
||||||
|
|
||||||
import { useInstanceStore } from 'src/stores/instance.js'
|
import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
import { useInterfaceStore } from 'src/stores/interface'
|
import { useInterfaceStore } from 'src/stores/interface'
|
||||||
|
|
@ -54,17 +55,9 @@ const ChatMessage = {
|
||||||
UserPopover,
|
UserPopover,
|
||||||
StatusPopover,
|
StatusPopover,
|
||||||
MentionLink,
|
MentionLink,
|
||||||
|
Timeago,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
// Returns HH:MM (hours and minutes) in local time.
|
|
||||||
createdAt() {
|
|
||||||
const time = this.chatItem.data.created_at
|
|
||||||
return time.toLocaleTimeString('en', {
|
|
||||||
hour: '2-digit',
|
|
||||||
minute: '2-digit',
|
|
||||||
hour12: false,
|
|
||||||
})
|
|
||||||
},
|
|
||||||
isStatus() {
|
isStatus() {
|
||||||
// ChatMessage only has account_id while Status has full user data
|
// ChatMessage only has account_id while Status has full user data
|
||||||
return !!this.message.user
|
return !!this.message.user
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,16 @@
|
||||||
spin
|
spin
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
{{ createdAt }}
|
{{ ' ' }}
|
||||||
|
<router-link
|
||||||
|
class="timeago faint"
|
||||||
|
:to="{ name: 'conversation', params: { id: message.id } }"
|
||||||
|
>
|
||||||
|
<Timeago
|
||||||
|
:time="message.created_at"
|
||||||
|
:auto-update="60"
|
||||||
|
/>
|
||||||
|
</router-link>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</StatusContent>
|
</StatusContent>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue