From 2da0a65765a1263c02264800e3705d2a71752b09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 26 Dec 2018 09:00:48 -0500 Subject: [PATCH] fix: #7162 --- public/src/overrides.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/public/src/overrides.js b/public/src/overrides.js index 4e987e9b85..0263828fed 100644 --- a/public/src/overrides.js +++ b/public/src/overrides.js @@ -120,7 +120,18 @@ if (typeof window !== 'undefined') { $.timeago.settings.allowFuture = true; var userLang = config.userLang.replace('_', '-'); var options = { year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: 'numeric' }; - var dtFormat = new Intl.DateTimeFormat(userLang, options); + var formatFn; + if (typeof Intl === 'undefined') { + formatFn = function (date) { + return date.toLocaleString(userLang, options); + }; + } else { + var dtFormat = new Intl.DateTimeFormat(userLang, options); + formatFn = function (date) { + return dtFormat.format(date); + }; + } + var iso; var date; $.fn.timeago = function () { @@ -134,7 +145,7 @@ if (typeof window !== 'undefined') { this.setAttribute('datetime', iso); date = new Date(iso); if (!isNaN(date)) { - this.textContent = dtFormat.format(date); + this.textContent = formatFn(date); } });