From 2ffe62846b7b0d1bed9e4afe51b4bc298515abc4 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 19 Oct 2016 16:10:31 +1100 Subject: [PATCH] FIX: broken localization for auto close --- .../discourse/controllers/edit-topic-auto-close.js.es6 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/controllers/edit-topic-auto-close.js.es6 b/app/assets/javascripts/discourse/controllers/edit-topic-auto-close.js.es6 index bb857e8d035..a6a4d0ebd18 100644 --- a/app/assets/javascripts/discourse/controllers/edit-topic-auto-close.js.es6 +++ b/app/assets/javascripts/discourse/controllers/edit-topic-auto-close.js.es6 @@ -69,7 +69,9 @@ export default Ember.Controller.extend(ModalFunctionality, { willCloseI18n: function() { if (this.get('model.details.auto_close_based_on_last_post')) { - return I18n.t('topic.auto_close_immediate', {count: this.get('model.auto_close_time')}); + let closeDate = new Date(this.get('model.last_posted_at')); + let diff = Math.round((new Date() - closeDate)/(1000*60*60)); + return I18n.t('topic.auto_close_immediate', {count: diff}); } }.property('model.details.auto_close_based_on_last_post', 'model.auto_close_time')