#147 Display correct timezone on hover

This commit is contained in:
Serraniel 2020-12-28 17:17:56 +01:00
parent 25bb2de5cd
commit 85bd44b677
Signed by: Serraniel
GPG key ID: 3690B4E7364525D3

View file

@ -156,6 +156,16 @@ function updateTime(node) {
return true;
}
function updateTimeZone(node) {
const HINT_UTC = 'UTC+1';
if (node.textContent === HINT_UTC) {
let tzMeta = spacetime().timezone();
console.log(tzMeta);
node.textContent = `${tzMeta.name} (UTC${tzMeta.current.offset >= 0 ? '+' : ''}${tzMeta.current.offset})`;
}
}
function updateTimestamps(node) {
let nodes = helper.findTextNodes(node);
@ -179,5 +189,7 @@ function updateTimestamps(node) {
__alteredNodes.push(node);
return;
}
updateTimeZone(node);
});
}