From d0d6b8ce9791f04840ee3979fe2f7f964d458364 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Sat, 21 May 2022 19:21:31 +0800 Subject: [PATCH] =?UTF-8?q?perf:=207=E5=A4=A9=E5=86=85=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=97=B6=E9=97=B4m-d=20H:i?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/assets/js/functions/web.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/resources/assets/js/functions/web.js b/resources/assets/js/functions/web.js index 71f0a27b8..16ffb726c 100755 --- a/resources/assets/js/functions/web.js +++ b/resources/assets/js/functions/web.js @@ -103,10 +103,13 @@ */ formatTime(date) { let time = $A.Date(date, true), + now = $A.Time(), string = ''; - if ($A.formatDate('Ymd') === $A.formatDate('Ymd', time)) { + if ($A.formatDate('Ymd', now) === $A.formatDate('Ymd', time)) { string = $A.formatDate('H:i', time) - } else if ($A.formatDate('Y') === $A.formatDate('Y', time)) { + } else if (now - time < 86400 * 7) { + string = $A.formatDate('m-d H:i', time) + } else if ($A.formatDate('Y', now) === $A.formatDate('Y', time)) { string = $A.formatDate('m-d', time) } else { string = $A.formatDate('Y-m-d', time)