Skip to content

Node.js based forum software built for the modern web

closes #5242

barisusakli4cb48c46ab4d
diff --git a/public/src/overrides.js b/public/src/overrides.js
index 8d48b21f2a..a5216910d2 100644
--- a/public/src/overrides.js
+++ b/public/src/overrides.js
@@ -150,7 +150,12 @@ if ('undefined' !== typeof window) {
overrides.overrideTimeago = function () {
var timeagoFn = $.fn.timeago;
- $.timeago.settings.cutoff = 1000 * 60 * 60 * 24 * (parseInt(config.timeagoCutoff, 10) || 60);
+ if (parseInt(config.timeagoCutoff, 10) === 0) {
+ $.timeago.settings.cutoff = 1;
+ } else if (parseInt(config.timeagoCutoff, 10) > 0) {
+ $.timeago.settings.cutoff = 1000 * 60 * 60 * 24 * (parseInt(config.timeagoCutoff, 10) || 30);
+ }
+
$.fn.timeago = function () {
var els = $(this);
diff --git a/src/controllers/api.js b/src/controllers/api.js
index f5dcdfa54e..f9e317cee7 100644
--- a/src/controllers/api.js
+++ b/src/controllers/api.js
@@ -63,7 +63,9 @@ apiController.getConfig = function (req, res, next) {
config.csrf_token = req.csrfToken();
config.searchEnabled = plugins.hasListeners('filter:search.query');
config.bootswatchSkin = 'default';
- config.timeagoCutoff = meta.config.timeagoCutoff;
+
+ var timeagoCutoff = meta.config.timeagoCutoff === undefined ? 30 : meta.config.timeagoCutoff;
+ config.timeagoCutoff = timeagoCutoff !== '' ? Math.max(0, parseInt(timeagoCutoff, 10)) : timeagoCutoff;
config.cookies = {
enabled: parseInt(meta.config.cookieConsentEnabled, 10) === 1,
diff --git a/src/views/admin/settings/post.tpl b/src/views/admin/settings/post.tpl
index 559f7094b0..a9b784957c 100644
--- a/src/views/admin/settings/post.tpl
+++ b/src/views/admin/settings/post.tpl
@@ -94,7 +94,7 @@
<p class="help-block">
Dates &amp; times will be shown in a relative manner (e.g. "3 hours ago" / "5 days ago"), and localised into various
languages. After a certain point, this text can be switched to display the localised date itself
- (e.g. 5 Nov 2016 15:30).<br /><em>(Default: <code>30</code>, or one month)</em>
+ (e.g. 5 Nov 2016 15:30).<br /><em>(Default: <code>30</code>, or one month). Set to 0 to always display dates, leave blank to always display relative times.</em>
</p>
</div>
</form>