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 ((json) => json.map ((entry) => {
entry.data = JSON.parse (entry.data);
const time
= (/(?<y>[0-9]+-[0-9]+-[0-9]+)T(?<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;