From c2d624cace23e834238649ee1f96e71854d2bc63 Mon Sep 17 00:00:00 2001 From: Vitalii Lysak Date: Thu, 22 Sep 2022 10:44:35 +0300 Subject: SILABMC-316: upd date and time by time zone --- src/store/modules/GlobalStore.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/store/modules') diff --git a/src/store/modules/GlobalStore.js b/src/store/modules/GlobalStore.js index 14c10b7c..3dcbe040 100644 --- a/src/store/modules/GlobalStore.js +++ b/src/store/modules/GlobalStore.js @@ -1,4 +1,5 @@ import api from '@/store/api'; +import { getDateByTimeZone } from '@/utilities/_sila/convertTimeZone'; const HOST_STATE = { on: 'xyz.openbmc_project.State.Host.HostState.Running', @@ -7,14 +8,6 @@ const HOST_STATE = { diagnosticMode: 'xyz.openbmc_project.State.Host.HostState.DiagnosticMode', }; -const convertTZ = (date, tzString) => { - return new Date( - (typeof date === 'string' ? new Date(date) : date).toLocaleString('en-US', { - timeZone: tzString, - }) - ); -}; - const serverStateMapper = (hostState) => { switch (hostState) { case HOST_STATE.on: @@ -146,7 +139,7 @@ const GlobalStore = { const bmcDateTime = response.data.DateTime; const date = new Date(bmcDateTime); const timeZone = getters.timeZone.split(' ')[1]; - commit('setBmcTime', convertTZ(date, timeZone)); + commit('setBmcTime', getDateByTimeZone(date, timeZone)); dispatch('initLiveClock'); }) .catch((error) => console.log(error)); -- cgit v1.2.3