From 9d91740f6ef03f190dc2307540206b658460243f Mon Sep 17 00:00:00 2001 From: Timo Hocker Date: Fri, 28 Aug 2020 17:40:20 +0200 Subject: [PATCH] display timestamps in local timezone --- src/store/index.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 121a0d7..2906ea5 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -41,13 +41,11 @@ export default new Vuex.Store ({ .then ((res) => res.json ()) .then ((json) => json.map ((entry) => { entry.data = JSON.parse (entry.data); - const time - = (/(?[0-9]+-[0-9]+-[0-9]+)T(?[0-9]+:[0-9]+:[0-9]+)/u) - .exec ( - new Date (entry.timestamp) - .toISOString () - ); - entry.timestamp = `${time.groups.y} ${time.groups.t}`; + const time = new Date (entry.timestamp); + time.setMinutes (time.getMinutes () - time.getTimezoneOffset ()); + entry.timestamp = time.toISOString () + .replace ('T', ' ') + .substr (0, 19); return entry; })); logs[source.name] = log;