From daeb1168c77459b2781db3b72690b0dcdd09ae81 Mon Sep 17 00:00:00 2001 From: Fine Date: Thu, 8 Sep 2022 22:08:29 +0800 Subject: [PATCH] fix dates --- src/layout/components/NavBar.vue | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/layout/components/NavBar.vue b/src/layout/components/NavBar.vue index 19355743..d5710e7c 100644 --- a/src/layout/components/NavBar.vue +++ b/src/layout/components/NavBar.vue @@ -18,7 +18,7 @@ limitations under the License. -->
{{ t("timeTips") }} (""); const timeRange = ref(0); -const time = ref([ - appStore.durationRow.start, - appStore.durationRow.end, -]); resetDuration(); getVersion(); @@ -73,15 +68,13 @@ const setConfig = (value: string) => { pageName.value = value || ""; }; -const handleReload = () => { +function handleReload() { const gap = appStore.duration.end.getTime() - appStore.duration.start.getTime(); - const dates: Date[] = [ - getLocalTime(appStore.utc, new Date(new Date().getTime() - gap)), - getLocalTime(appStore.utc, new Date()), - ]; + const dates: Date[] = [new Date(new Date().getTime() - gap), new Date()]; appStore.setDuration(timeFormat(dates)); -}; +} + function changeTimeRange(val: Date[] | any) { timeRange.value = val[1].getTime() - val[0].getTime() > 60 * 24 * 60 * 60 * 1000 ? 1 : 0; @@ -114,7 +107,6 @@ function resetDuration() { step: d.step, }); appStore.updateUTC(d.utc); - time.value = [new Date(d.start), new Date(d.end)]; } }