summaryrefslogtreecommitdiff
path: root/src/jwebmail/static/src/localtime.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/jwebmail/static/src/localtime.js')
-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));
});