2018-03-17 18:26:18 +05:30
|
|
|
import { formatDate, getTimeago } from '../../lib/utils/datetime_utility';
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
/**
|
|
|
|
* Mixin with time ago methods used in some vue components
|
|
|
|
*/
|
|
|
|
export default {
|
|
|
|
methods: {
|
2020-01-01 13:55:28 +05:30
|
|
|
timeFormatted(time) {
|
2018-03-17 18:26:18 +05:30
|
|
|
const timeago = getTimeago();
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
return timeago.format(time);
|
|
|
|
},
|
|
|
|
|
|
|
|
tooltipTitle(time) {
|
2018-03-17 18:26:18 +05:30
|
|
|
return formatDate(time);
|
2017-09-10 17:25:29 +05:30
|
|
|
},
|
2021-06-08 01:23:25 +05:30
|
|
|
|
|
|
|
durationTimeFormatted(duration) {
|
|
|
|
const date = new Date(duration * 1000);
|
|
|
|
|
|
|
|
let hh = date.getUTCHours();
|
|
|
|
let mm = date.getUTCMinutes();
|
|
|
|
let ss = date.getSeconds();
|
|
|
|
|
|
|
|
if (hh < 10) {
|
|
|
|
hh = `0${hh}`;
|
|
|
|
}
|
|
|
|
if (mm < 10) {
|
|
|
|
mm = `0${mm}`;
|
|
|
|
}
|
|
|
|
if (ss < 10) {
|
|
|
|
ss = `0${ss}`;
|
|
|
|
}
|
|
|
|
|
|
|
|
return `${hh}:${mm}:${ss}`;
|
|
|
|
},
|
2017-09-10 17:25:29 +05:30
|
|
|
},
|
|
|
|
};
|