debian-mirror-gitlab/app/assets/javascripts/vue_shared/mixins/timeago.js
2022-07-16 19:58:13 +02:00

18 lines
388 B
JavaScript

import { formatDate, getTimeago, timeagoLanguageCode } 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, timeagoLanguageCode);
},
tooltipTitle(time) {
return formatDate(time);
},
},
};