From 2b9d3e99d31bf67d0834fe2d8f7164ac10daef23 Mon Sep 17 00:00:00 2001 From: TwiN Date: Sun, 12 Jun 2022 18:40:24 -0400 Subject: [PATCH] refactor: Fix indent --- web/app/src/mixins/helper.js | 36 ++++++++++++++++++------------------ web/app/src/views/Home.vue | 5 +++-- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/web/app/src/mixins/helper.js b/web/app/src/mixins/helper.js index 4c1be935..be5ddfab 100644 --- a/web/app/src/mixins/helper.js +++ b/web/app/src/mixins/helper.js @@ -1,22 +1,22 @@ export const helper = { - methods: { - generatePrettyTimeAgo(t) { - let differenceInMs = new Date().getTime() - new Date(t).getTime(); - if (differenceInMs > 3*86400000) { // If it was more than 3 days ago, we'll display the number of days ago - let days = (differenceInMs / 86400000).toFixed(0); - return days + " day" + (days !== "1" ? "s" : "") + " ago"; - } - if (differenceInMs > 3600000) { // If it was more than 1h ago, display the number of hours ago - 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"; - } + methods: { + generatePrettyTimeAgo(t) { + let differenceInMs = new Date().getTime() - new Date(t).getTime(); + if (differenceInMs > 3 * 86400000) { // If it was more than 3 days ago, we'll display the number of days ago + let days = (differenceInMs / 86400000).toFixed(0); + return days + " day" + (days !== "1" ? "s" : "") + " ago"; + } + if (differenceInMs > 3600000) { // If it was more than 1h ago, display the number of hours ago + 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"; + } let seconds = (differenceInMs / 1000).toFixed(0); - return seconds + " second" + (seconds !== "1" ? "s" : "") + " ago"; - }, + return seconds + " second" + (seconds !== "1" ? "s" : "") + " ago"; + }, generatePrettyTimeDifference(start, end) { let minutes = Math.ceil((new Date(start) - new Date(end)) / 1000 / 60); return minutes + (minutes === 1 ? ' minute' : ' minutes'); @@ -31,5 +31,5 @@ export const helper = { let ss = ((date.getSeconds()) < 10 ? "0" : "") + "" + (date.getSeconds()); return YYYY + "-" + MM + "-" + DD + " " + hh + ":" + mm + ":" + ss; }, - } + } } diff --git a/web/app/src/views/Home.vue b/web/app/src/views/Home.vue index 523385b2..7957fd2e 100644 --- a/web/app/src/views/Home.vue +++ b/web/app/src/views/Home.vue @@ -1,11 +1,12 @@