summaryrefslogtreecommitdiff
path: root/src/store
diff options
context:
space:
mode:
authorVitalii Lysak <v.lysak@dunice.net>2022-09-21 18:32:09 +0300
committerVitalii Lysak <v.lysak@dunice.net>2022-09-21 18:32:09 +0300
commit3731ececbd603859fe83b49a2b19f33c2c3e43ec (patch)
tree52c8ed4876bdeef5aefc547a77a84bffd702748c /src/store
parent5ad081015c923158c67108af6f3b58ce8ff764c9 (diff)
downloadwebui-vue-3731ececbd603859fe83b49a2b19f33c2c3e43ec.tar.xz
SILABMC-316: add time zone
Diffstat (limited to 'src/store')
-rw-r--r--src/store/modules/GlobalStore.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/store/modules/GlobalStore.js b/src/store/modules/GlobalStore.js
index 3f512087..14c10b7c 100644
--- a/src/store/modules/GlobalStore.js
+++ b/src/store/modules/GlobalStore.js
@@ -39,8 +39,8 @@ const GlobalStore = {
state: {
assetTag: null,
bmcTime: null,
- liveBmcTime: null,
liveClock: null,
+ liveDate: null,
clockInterval: null,
modelType: null,
serialNumber: null,
@@ -59,8 +59,8 @@ const GlobalStore = {
serialNumber: (state) => state.serialNumber,
serverStatus: (state) => state.serverStatus,
bmcTime: (state) => state.bmcTime,
- liveBmcTime: (state) => state.liveBmcTime,
liveClock: (state) => state.liveClock,
+ liveDate: (state) => state.liveDate,
timeZone: (state) => state.timeZone,
languagePreference: (state) => state.languagePreference,
isUtcDisplay: (state) => state.isUtcDisplay,
@@ -73,7 +73,7 @@ const GlobalStore = {
setSerialNumber: (state, serialNumber) =>
(state.serialNumber = serialNumber),
setBmcTime: (state, bmcTime) => (state.bmcTime = bmcTime),
- setLiveBmcTime: (state, liveBmcTime) => (state.liveBmcTime = liveBmcTime),
+ setLiveDate: (state, liveDate) => (state.liveDate = liveDate),
setLiveClock: (state, liveClock) => (state.liveClock = liveClock),
setTimeZone: (state, timeZone) => {
state.timeZone = timeZone;
@@ -114,17 +114,23 @@ const GlobalStore = {
let clockData = state.bmcTime;
let clockInterval = setInterval(() => {
clockData.setSeconds(clockData.getSeconds() + 1);
- commit('setLiveBmcTime', clockData.toString());
+ let year = clockData.getFullYear();
+ let month = clockData.getMonth() + 1;
+ let day = clockData.getDate();
let hours = clockData.getHours();
let minutes = clockData.getMinutes();
let sec = clockData.getSeconds();
+ if (month < 10) {
+ month = '0' + month;
+ }
if (minutes < 10) {
minutes = '0' + minutes;
}
if (sec < 10) {
sec = '0' + sec;
}
+ commit('setLiveDate', year + '-' + month + '-' + day);
commit('setLiveClock', hours + ':' + minutes + ':' + sec);
}, 1000);
commit('setClockInterval', clockInterval);