Explorar el Código

feat: 修改bug

Moss hace 1 año
padre
commit
e6d2345357
Se han modificado 1 ficheros con 2 adiciones y 3 borrados
  1. 2 3
      src/filters/index.js

+ 2 - 3
src/filters/index.js

@@ -89,11 +89,10 @@ export function timeFilter(date) {
   if (diff < 30) {
     return '刚刚'
   } else if (diff < 3600) {
-    // less 1 hour
     return Math.ceil(diff / 60) + '分钟前'
   } else if (diff < 3600 * 24) {
     return Math.ceil(diff / 3600) + '小时前'
-  } else if (diff < 3600 * 24 * 2) {
-    return '1天前'
+  } else if (diff >= 3600 * 24) {
+    return Math.ceil(diff / 3600 / 24) + '天前'
   }
 }