summaryrefslogtreecommitdiff
path: root/src/store/modules
diff options
context:
space:
mode:
authorVitalii Lysak <v.lysak@dunice.net>2022-09-22 10:44:35 +0300
committerVitalii Lysak <v.lysak@dunice.net>2022-09-22 10:44:35 +0300
commitc2d624cace23e834238649ee1f96e71854d2bc63 (patch)
treeac4557e73b7fddb4cf322cdd195f270c9d08032e /src/store/modules
parent3731ececbd603859fe83b49a2b19f33c2c3e43ec (diff)
downloadwebui-vue-c2d624cace23e834238649ee1f96e71854d2bc63.tar.xz
SILABMC-316: upd date and time by time zone
Diffstat (limited to 'src/store/modules')
-rw-r--r--src/store/modules/GlobalStore.js11
1 files changed, 2 insertions, 9 deletions
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));