From f561dc0bc191ee51123815463a13eae3fe4343f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?W=2E=E2=80=89Mark=20Kubacki?= Date: Wed, 27 Apr 2016 19:24:42 +0200 Subject: [PATCH] browse: Serve a datetime format the IE11 and Firefox understand Another new safeguard is that we check whether the datetime has been read correctly. If not then the listing will not be localized. closes #793 --- caddy/setup/browse.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/caddy/setup/browse.go b/caddy/setup/browse.go index 4d3eaf819..6039480b6 100644 --- a/caddy/setup/browse.go +++ b/caddy/setup/browse.go @@ -385,7 +385,7 @@ footer { {{- else}} {{.HumanSize}} {{- end}} - + {{- end}} @@ -401,6 +401,12 @@ footer { return; } var d = new Date(e.getAttribute('datetime')); + if (isNaN(d)) { + d = new Date(e.textContent); + if (isNaN(d)) { + return; + } + } e.textContent = d.toLocaleString(); } var timeList = Array.prototype.slice.call(document.getElementsByTagName("time"));