FIX: broken localization for auto close

This commit is contained in:
Sam 2016-10-19 16:10:31 +11:00
parent a6ad762189
commit 2ffe62846b

View File

@ -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')