summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_shared/mixins/timeago.js
blob: af14c6d948610aa3a89e59b84cf401ca4d3d12be (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);
    },
  },
};