debian-mirror-gitlab/app/assets/javascripts/vue_shared/mixins/timeago.js
2023-07-09 08:55:56 +05:30

18 lines
402 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, format) {
const timeago = getTimeago(format);
return timeago.format(time, timeagoLanguageCode);
},
tooltipTitle(time) {
return formatDate(time);
},
},
};