diff options
author | Jannis M. Hoffmann <jannis@fehcom.de> | 2024-04-10 21:04:33 +0200 |
---|---|---|
committer | Jannis M. Hoffmann <jannis@fehcom.de> | 2024-04-10 21:04:33 +0200 |
commit | 8faa2973a26818561d316c9eccd136bbf086546f (patch) | |
tree | 33c7081fe6c186ad9040d00a4ce9d843142e97be | |
parent | b73ed6ebd3cca86de065549cfb0d109a1d0461c5 (diff) |
fix local datetime calculation
-rw-r--r-- | src/jwebmail/static/src/localtime.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/jwebmail/static/src/localtime.js b/src/jwebmail/static/src/localtime.js index daa1455..11e42b3 100644 --- a/src/jwebmail/static/src/localtime.js +++ b/src/jwebmail/static/src/localtime.js @@ -1,5 +1,8 @@ +const dtFormat = new Intl.DateTimeFormat(document.documentElement.lang, { + dateStyle: 'short', + timeStyle: 'short', +}); + document.querySelectorAll('time.jwm-tolocaltime').forEach($e => { - const dateTime = new Date($e.dateTime); - $e.innerHTML = new Intl.DateTimeFormat(document.documentElement.lang). - format(dateTime.toLocaleString()); + $e.innerHTML = dtFormat.format(Date.parse($e.dateTime)); }); |