From 1410f890f322eb8a22ba60946db4d4b33f9a5716 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B4=AA=E6=B4=AA?= <2498601771@qq.com> Date: Wed, 8 Nov 2023 15:42:23 +0800 Subject: [PATCH] =?UTF-8?q?CN-1415=20fix:=20=E4=BF=AE=E5=A4=8D=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E5=8E=86=E5=8F=B2=E6=8E=92=E5=BA=8F=E4=B8=8E=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=B1=95=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/tools.js | 6 +++--- src/views/entityExplorer/search/ExplorerSearch.vue | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/utils/tools.js b/src/utils/tools.js index fb3c3330..2f075a19 100644 --- a/src/utils/tools.js +++ b/src/utils/tools.js @@ -1407,10 +1407,10 @@ export const myHighLight = { export const changeTimeByDate = (date) => { if (date) { const nowDate = Date.now() - const oldDate = Date.parse(date) + const oldDate = isNaN(date) ? Date.parse(date) : date const diff = Math.floor((nowDate - oldDate) / 1000) if (diff < 60) { - return 60 + i18n.global.t('entity.search.secondsAgo') + return diff + i18n.global.t('entity.search.secondsAgo') } else if (diff >= 60 && diff < 3600) { const minutes = Math.floor(diff / 60) return minutes === 1 ? `${minutes} ${i18n.global.t('entity.search.minuteAgo')}` : `${minutes} ${i18n.global.t('entity.search.minutesAgo')}` @@ -1418,7 +1418,7 @@ export const changeTimeByDate = (date) => { const hours = Math.floor(diff / 3600) return hours === 1 ? `${hours} ${i18n.global.t('entity.search.hourAgo')}` : `${hours} ${i18n.global.t('entity.search.hoursAgo')}` } else { - return new Date(oldDate) + return (new Date(oldDate).toString()).replace(/GMT.*/, '') } } } diff --git a/src/views/entityExplorer/search/ExplorerSearch.vue b/src/views/entityExplorer/search/ExplorerSearch.vue index 323bdcff..fe0638a3 100644 --- a/src/views/entityExplorer/search/ExplorerSearch.vue +++ b/src/views/entityExplorer/search/ExplorerSearch.vue @@ -36,7 +36,6 @@