mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
Use moment.js in auto close js
This commit is contained in:
parent
eeef24b9da
commit
c2088f5b5d
1 changed files with 2 additions and 1 deletions
|
@ -11,9 +11,10 @@ Discourse.EditTopicAutoCloseController = Discourse.ObjectController.extend(Disco
|
|||
|
||||
setDays: function() {
|
||||
if( this.get('details.auto_close_at') ) {
|
||||
console.log( this.get('details.auto_close_at') );
|
||||
var closeTime = new Date( this.get('details.auto_close_at') );
|
||||
if (closeTime > new Date()) {
|
||||
this.set('auto_close_days', closeTime.daysSince());
|
||||
this.set('auto_close_days', Math.round(moment(closeTime).diff(new Date(), 'days', true)));
|
||||
}
|
||||
} else {
|
||||
this.set('details.auto_close_days', '');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue