diff --git a/public/src/overrides.js b/public/src/overrides.js index d2120876c1..a2d213f45c 100644 --- a/public/src/overrides.js +++ b/public/src/overrides.js @@ -150,6 +150,7 @@ if ('undefined' !== typeof window) { overrides.overrideTimeago = function () { var timeagoFn = $.fn.timeago; + $.timeago.settings.cutoff = 1000 * 60 * 60 * 24 * 30; $.fn.timeago = function () { var els = timeagoFn.apply(this, arguments); diff --git a/public/vendor/jquery/timeago/jquery.timeago.js b/public/vendor/jquery/timeago/jquery.timeago.js index c85ebcc5b0..8727fa7adb 100644 --- a/public/vendor/jquery/timeago/jquery.timeago.js +++ b/public/vendor/jquery/timeago/jquery.timeago.js @@ -194,7 +194,41 @@ $(this).text(inWords(data.datetime)); } else { if ($(this).attr('title').length > 0) { - $(this).text($(this).attr('title')); + //$(this).text($(this).attr('title')); + var languageCode = void 0; + switch (config.userLang) { + case 'en_GB': + case 'en_US': + languageCode = 'en'; + break; + + case 'fa_IR': + languageCode = 'fa'; + break; + + case 'pt_BR': + languageCode = 'pt-br'; + break; + + case 'nb': + languageCode = 'no'; + break; + + case 'zh_TW': + languageCode = 'zh-TW'; + break; + + case 'zh_CN': + languageCode = 'zh-CN'; + break; + + default: + languageCode = config.userLang; + break; + } + + var options = { year: 'numeric', month: 'long', day: 'numeric' }; + $(this).text(new Date($(this).attr('title')).toLocaleString(languageCode, options)); } } }