summaryrefslogtreecommitdiff
path: root/src/store
diff options
context:
space:
mode:
authorDixsie Wolmers <dixsie@ibm.com>2020-02-24 00:56:16 +0300
committerDerick Montague <derick.montague@ibm.com>2020-02-28 17:42:51 +0300
commit97f4187e1bac021ea7b5a0f5a780a3d4004edf64 (patch)
treed6851088fb7282b32a7dc66d41ea54a363b11b5f /src/store
parent5bb956d7596f3a91bed0554bf47552039f2c0713 (diff)
downloadwebui-vue-97f4187e1bac021ea7b5a0f5a780a3d4004edf64.tar.xz
Format date and time for international locales
Uninstalls vue-date-fns and uses toLocaleDateString() method to return formatted date and time. Date language is set by i18n and time/timezone is formatted by browser locale. Uses vue filter to format date and time as: - short month, day, year, time and timezone - 'en' example: Feb 23, 2020, 3:40:25 PM CST - 'es' example: 25 feb 2020 14:23:36 GMT-6 - hour12 value is determined by browser default Signed-off-by: Dixsie Wolmers <dixsie@ibm.com> Change-Id: I4fe8c51f5437cef263f1e0ea4184c0b552c85f4d
Diffstat (limited to 'src/store')
-rw-r--r--src/store/modules/GlobalStore.js9
-rw-r--r--src/store/modules/Health/EventLogStore.js3
2 files changed, 7 insertions, 5 deletions
diff --git a/src/store/modules/GlobalStore.js b/src/store/modules/GlobalStore.js
index 21ea796f..dd12fc23 100644
--- a/src/store/modules/GlobalStore.js
+++ b/src/store/modules/GlobalStore.js
@@ -25,7 +25,7 @@ const GlobalStore = {
namespaced: true,
state: {
hostName: '--',
- bmcTime: null,
+ bmcTime: '--',
hostStatus: 'unreachable'
},
getters: {
@@ -53,9 +53,10 @@ const GlobalStore = {
api
.get('/xyz/openbmc_project/time/bmc')
.then(response => {
- // bmcTime is stored in microseconds, convert to millseconds
- const bmcTime = response.data.data.Elapsed / 1000;
- commit('setBmcTime', bmcTime);
+ // bmcTime is stored in microseconds, convert to milliseconds
+ const bmcEpochTime = response.data.data.Elapsed / 1000;
+ const date = new Date(bmcEpochTime);
+ commit('setBmcTime', date);
})
.catch(error => console.log(error));
},
diff --git a/src/store/modules/Health/EventLogStore.js b/src/store/modules/Health/EventLogStore.js
index 3f32ab16..d2f970ae 100644
--- a/src/store/modules/Health/EventLogStore.js
+++ b/src/store/modules/Health/EventLogStore.js
@@ -68,6 +68,7 @@ const EventLogStore = {
.then(response => {
const responseData = response.data.data;
const eventLogs = [];
+
for (const key in responseData) {
const event = responseData[key];
const { Id } = event;
@@ -76,7 +77,7 @@ const EventLogStore = {
eventLogs.push({
logId: Id,
priority: priorityMapper(Severity),
- timestamp: Timestamp,
+ timestamp: new Date(Timestamp),
eventID: EventID,
description: Description,
...event