Explorar el Código

Update PostComponent.vue, use timeAgo util

Daniel Supernault hace 5 años
padre
commit
c95dd26a79
Se han modificado 1 ficheros con 1 adiciones y 23 borrados
  1. 1 23
      resources/assets/js/components/PostComponent.vue

+ 1 - 23
resources/assets/js/components/PostComponent.vue

@@ -1066,29 +1066,7 @@ export default {
       },
       },
 
 
       timeAgo(ts) {
       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() {
       emojiReaction() {