From 93738ef0aae6794b52b0337a538e3946071664d0 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Tue, 30 Apr 2024 12:52:35 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=AD=97=E6=AE=B5=E8=B7=B3=E8=BD=AC=E7=B2=BE?= =?UTF-8?q?=E7=A1=AE=E5=88=B0=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/frontend/src/utils/timeUitils.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/frontend/src/utils/timeUitils.js b/core/frontend/src/utils/timeUitils.js index 4a94c8dad7..0455d82606 100644 --- a/core/frontend/src/utils/timeUitils.js +++ b/core/frontend/src/utils/timeUitils.js @@ -15,6 +15,8 @@ export const getRange = (selectValue, timeGranularity) => { case 'minute': case 'y_M_d_H_m': return getMinuteEnd(selectValue) + case 'y_M_d_H_m_s': + return getSecondEnd(selectValue) case 'datetime': return [+new Date(selectValue), +new Date(selectValue)] default: @@ -63,6 +65,10 @@ const getMinuteEnd = timestamp => { return [+new Date(timestamp), +new Date(timestamp) + 60 * 1000 - 1000] } +const getSecondEnd = timestamp => { + return [+new Date(timestamp), +new Date(timestamp) + 999] +} + const getYearBegin = timestamp => { const time = new Date(timestamp) return +new Date(time.getFullYear(), 0, 1)