display timestamps in local timezone

This commit is contained in:
Timo Hocker 2020-08-28 17:40:20 +02:00
parent 1a75f8c242
commit 9d91740f6e

View File

@ -41,13 +41,11 @@ export default new Vuex.Store ({
.then ((res) => res.json ()) .then ((res) => res.json ())
.then ((json) => json.map ((entry) => { .then ((json) => json.map ((entry) => {
entry.data = JSON.parse (entry.data); entry.data = JSON.parse (entry.data);
const time const time = new Date (entry.timestamp);
= (/(?<y>[0-9]+-[0-9]+-[0-9]+)T(?<t>[0-9]+:[0-9]+:[0-9]+)/u) time.setMinutes (time.getMinutes () - time.getTimezoneOffset ());
.exec ( entry.timestamp = time.toISOString ()
new Date (entry.timestamp) .replace ('T', ' ')
.toISOString () .substr (0, 19);
);
entry.timestamp = `${time.groups.y} ${time.groups.t}`;
return entry; return entry;
})); }));
logs[source.name] = log; logs[source.name] = log;