summaryrefslogtreecommitdiffstats
path: root/script.js
diff options
context:
space:
mode:
Diffstat (limited to 'script.js')
-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();