summaryrefslogtreecommitdiffstats
path: root/script.js
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2026-10-15 14:18:54 -0400
committerSacha Chua <sacha@sachachua.com>2026-10-15 14:18:54 -0400
commit1bb8b0557336b4ceba5262e847869bfb63c5e006 (patch)
tree6b162c75a8ff5632d9ab2b9288a7871dcc3bdd06 /script.js
parentd77c389dfe488d14823a99897af6ed7906cdc4ed (diff)
downloademacsconf-wiki-1bb8b0557336b4ceba5262e847869bfb63c5e006.tar.xz
emacsconf-wiki-1bb8b0557336b4ceba5262e847869bfb63c5e006.zip
translate to local time
Diffstat (limited to '')
-rw-r--r--script.js22
1 files changed, 18 insertions, 4 deletions
diff --git a/script.js b/script.js
index 9777c060..4f89f4d6 100644
--- a/script.js
+++ b/script.js
@@ -62,18 +62,32 @@
// @license magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt txt CC0-1.0
// Copyright (C) 2021, 2022, 2026 Sacha Chua
- function addLocalTimeToSVGs() {
+function addLocalTimeToSVGs() {
var dateOptions = {
year: 'numeric', month: 'numeric', day: 'numeric',
- hour: 'numeric', minute: 'numeric',
- timeZoneName: 'short' };
+ hour: 'numeric', minute: 'numeric',
+ timeZoneName: 'short'
+ };
document.querySelectorAll('svg a[data-start]').forEach((o) => {
let start = new Date(o.getAttribute('data-start'));
+ let end = new Date(o.getAttribute('data-end'));
let title = o.querySelector('title');
if (title) {
- title.textContent += ' = ' + start.toLocaleString([], dateOptions);
+ title.textContent =
+ start.toLocaleString([], {hour: 'numeric', minute: 'numeric'}).replace(/\\./g, '') + ' - ' +
+ end.toLocaleString([], {hour: 'numeric', minute: 'numeric', timeZoneName: 'short'}).replace(/\\./g, '') + ': ' + o.getAttribute('title');
}
});
+ document.querySelectorAll('.hour-label[data-start]').forEach((o) => {
+ let start = new Date(o.getAttribute('data-start'));
+ o.textContent = start.toLocaleString([], {hour: 'numeric', minute: 'numeric', timeZoneName: 'short'}).replace(/\./g, '');
+ });
+
+document.querySelectorAll('.day-label[data-start]').forEach((o) => {
+ let start = new Date(o.getAttribute('data-start'));
+ o.textContent = start.toLocaleString([], {weekday: 'long', month: 'short', day: 'numeric', timeZoneName: 'long'}).replace(/\./g, '');
+ });
+
}
addLocalTimeToSVGs();