From 30cf0fd22e492fd2b0052ddfd5b808da51b36052 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Thu, 18 Jan 2024 14:13:15 +0100 Subject: feat #29: add initial support for mtbfile api tokens --- src/main/resources/static/scripts.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/main/resources/static/scripts.js') diff --git a/src/main/resources/static/scripts.js b/src/main/resources/static/scripts.js index 73ad71b..fdd3f52 100644 --- a/src/main/resources/static/scripts.js +++ b/src/main/resources/static/scripts.js @@ -4,14 +4,17 @@ const dateFormat = new Intl.DateTimeFormat('de-DE', dateFormatOptions); 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); -window.addEventListener('load', () => { +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); function drawPieChart(url, elemId, title, data) { if (data) { -- cgit v1.2.3