diff options
| author | eugenijm <eugenijm@protonmail.com> | 2020-05-07 16:10:53 +0300 |
|---|---|---|
| committer | eugenijm <eugenijm@protonmail.com> | 2020-07-08 15:21:31 +0300 |
| commit | aa2cf51c05ebdf411d74af5debbbc8fa4d3cf457 (patch) | |
| tree | 6032c3ee359b20cefca000df93b59787fc0d54d9 /src/components/chat_message_date/chat_message_date.vue | |
| parent | a0ddcbdf5b19f658bc07086beaa4034a6309fe3b (diff) | |
Add Chats
Diffstat (limited to 'src/components/chat_message_date/chat_message_date.vue')
| -rw-r--r-- | src/components/chat_message_date/chat_message_date.vue | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/components/chat_message_date/chat_message_date.vue b/src/components/chat_message_date/chat_message_date.vue new file mode 100644 index 00000000..79c346b6 --- /dev/null +++ b/src/components/chat_message_date/chat_message_date.vue @@ -0,0 +1,24 @@ +<template> + <time> + {{ displayDate }} + </time> +</template> + +<script> +export default { + name: 'Timeago', + props: ['date'], + computed: { + displayDate () { + const today = new Date() + today.setHours(0, 0, 0, 0) + + if (this.date.getTime() === today.getTime()) { + return this.$t('display_date.today') + } else { + return this.date.toLocaleDateString('en', { day: 'numeric', month: 'long' }) + } + } + } +} +</script> |
