summaryrefslogtreecommitdiff
path: root/src/jwebmail
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis@fehcom.de>2024-04-10 21:04:33 +0200
committerJannis M. Hoffmann <jannis@fehcom.de>2024-04-10 21:04:33 +0200
commit8faa2973a26818561d316c9eccd136bbf086546f (patch)
tree33c7081fe6c186ad9040d00a4ce9d843142e97be /src/jwebmail
parentb73ed6ebd3cca86de065549cfb0d109a1d0461c5 (diff)
fix local datetime calculation
Diffstat (limited to 'src/jwebmail')
-rw-r--r--src/jwebmail/static/src/localtime.js9
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));
});