From c95dd26a7972dcf8ca795a009db86c0a06abd813 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 26 Apr 2020 02:49:28 -0600 Subject: [PATCH] Update PostComponent.vue, use timeAgo util --- .../assets/js/components/PostComponent.vue | 24 +------------------ 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/resources/assets/js/components/PostComponent.vue b/resources/assets/js/components/PostComponent.vue index 05aecb17..1432f83c 100644 --- a/resources/assets/js/components/PostComponent.vue +++ b/resources/assets/js/components/PostComponent.vue @@ -1066,29 +1066,7 @@ export default { }, timeAgo(ts) { - let date = Date.parse(ts); - let seconds = Math.floor((new Date() - date) / 1000); - let interval = Math.floor(seconds / 31536000); - if (interval >= 1) { - return interval + "y"; - } - interval = Math.floor(seconds / 604800); - if (interval >= 1) { - return interval + "w"; - } - interval = Math.floor(seconds / 86400); - if (interval >= 1) { - return interval + "d"; - } - interval = Math.floor(seconds / 3600); - if (interval >= 1) { - return interval + "h"; - } - interval = Math.floor(seconds / 60); - if (interval >= 1) { - return interval + "m"; - } - return Math.floor(seconds) + "s"; + return App.util.format.timeAgo(ts); }, emojiReaction() {