aboutsummaryrefslogtreecommitdiff
path: root/src/components/chat_message_date/chat_message_date.vue
blob: 79c346b6172bc0a65b6a1c4baebc005c0225a6d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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>