summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_shared/mixins/timeago.js
blob: c5f41d811673e7d4765cfc6625968f7b9bb29117 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { formatDate, getTimeago } from '~/lib/utils/datetime_utility';

/**
 * Mixin with time ago methods used in some vue components
 */
export default {
  methods: {
    timeFormatted(time) {
      const timeago = getTimeago();

      return timeago.format(time);
    },

    tooltipTitle(time) {
      return formatDate(time);
    },
  },
};