mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Use moment.js in auto close js
This commit is contained in:
parent
eeef24b9da
commit
c2088f5b5d
@ -11,9 +11,10 @@ Discourse.EditTopicAutoCloseController = Discourse.ObjectController.extend(Disco
|
|||||||
|
|
||||||
setDays: function() {
|
setDays: function() {
|
||||||
if( this.get('details.auto_close_at') ) {
|
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') );
|
var closeTime = new Date( this.get('details.auto_close_at') );
|
||||||
if (closeTime > new Date()) {
|
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 {
|
} else {
|
||||||
this.set('details.auto_close_days', '');
|
this.set('details.auto_close_days', '');
|
||||||
|
Loading…
Reference in New Issue
Block a user