diff options
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/modules/GlobalStore.js | 14 |
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); |