Skip to content

Commit

Permalink
Display local-formatted timestamp for chat messages
Browse files Browse the repository at this point in the history
instead of utc integer timestamp
  • Loading branch information
paulgoetze committed Dec 12, 2021
1 parent bdcff6f commit ad61d7d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/Chat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
:class="{'message-and-avatar--right': chatMessage.from !== localPeerId}">
<PeerAvatar :peerId="chatMessage.from" />
<span class="message"
:title="chatMessage.time"
:title="displayTime(chatMessage.time)"
v-html="escapeHTML(chatMessage.msg)">
</span>
</div>
Expand Down Expand Up @@ -86,6 +86,9 @@ export default {
this.$emit('send-chat-message', newMessage)
this.newChatMessage = ""
},
displayTime(time) {
return new Date(time).toLocaleString()
},
},
}
</script>
Expand Down

0 comments on commit ad61d7d

Please sign in to comment.