Add events to service detail page

This commit is contained in:
TwinProduction
2021-01-28 22:44:31 -05:00
parent 119b80edc0
commit fbb5d48bf7
9 changed files with 166 additions and 32 deletions

View File

@ -0,0 +1,16 @@
export const helper = {
methods: {
generatePrettyTimeAgo(t) {
let differenceInMs = new Date().getTime() - new Date(t).getTime();
if (differenceInMs > 3600000) {
let hours = (differenceInMs / 3600000).toFixed(0);
return hours + " hour" + (hours !== "1" ? "s" : "") + " ago";
}
if (differenceInMs > 60000) {
let minutes = (differenceInMs / 60000).toFixed(0);
return minutes + " minute" + (minutes !== "1" ? "s" : "") + " ago";
}
return (differenceInMs / 1000).toFixed(0) + " seconds ago";
},
}
}