summaryrefslogtreecommitdiff
path: root/src/web/main.js
diff options
context:
space:
mode:
authorPaul-Christian Volkmer2026-01-08 16:22:57 +0100
committerGitHub2026-01-08 15:22:57 +0000
commited4b068127530346345ed16b2e79b33bc5b03d57 (patch)
tree173d36e24bb04ea61a2a960dd765e1c745dd6f6b /src/web/main.js
parent7045318e87ecc853c000e9e11c955bc6298f2d56 (diff)
build: remove webjars and use custom build (#238)
Diffstat (limited to 'src/web/main.js')
-rw-r--r--src/web/main.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/web/main.js b/src/web/main.js
new file mode 100644
index 0000000..ca1ecc9
--- /dev/null
+++ b/src/web/main.js
@@ -0,0 +1,18 @@
+import * as styles from './style.css';
+
+import 'htmx.org';
+
+const dateTimeFormatOptions = { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: 'numeric', second: 'numeric' };
+const dateTimeFormat = new Intl.DateTimeFormat('de-DE', dateTimeFormatOptions);
+
+const formatTimeElements = () => {
+ Array.from(document.getElementsByTagName('time')).forEach((timeTag) => {
+ let date = Date.parse(timeTag.getAttribute('datetime'));
+ if (! isNaN(date)) {
+ timeTag.innerText = dateTimeFormat.format(date);
+ }
+ });
+};
+
+window.addEventListener('load', formatTimeElements);
+window.addEventListener('htmx:afterRequest', formatTimeElements); \ No newline at end of file