Format time, fix sort (#230)
This commit is contained in:
parent
ba10045a0f
commit
c914d94b18
3 changed files with 5 additions and 11 deletions
|
@ -14,7 +14,7 @@ class WidgetsController < ActionController::Base
|
||||||
source_id: cookie_params[:source_id]
|
source_id: cookie_params[:source_id]
|
||||||
)
|
)
|
||||||
|
|
||||||
@contact = contact_inbox.contact
|
@contact = contact_inbox ? contact_inbox.contact : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_token
|
def set_token
|
||||||
|
|
|
@ -150,10 +150,9 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
copyList = this.allChatList.slice();
|
copyList = this.allChatList.slice();
|
||||||
}
|
}
|
||||||
const sorted = copyList.sort((a, b) =>
|
const sorted = copyList.sort(
|
||||||
this.wootTime(this.lastMessage(a).created_at).isBefore(
|
(a, b) =>
|
||||||
this.wootTime(this.lastMessage(b).created_at)
|
this.lastMessage(b).created_at - this.lastMessage(a).created_at
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return sorted;
|
return sorted;
|
||||||
|
|
|
@ -15,12 +15,7 @@ export default {
|
||||||
},
|
},
|
||||||
dynamicTime(time) {
|
dynamicTime(time) {
|
||||||
const createdAt = moment(time * 1000);
|
const createdAt = moment(time * 1000);
|
||||||
return createdAt.calendar(null, {
|
return createdAt.fromNow();
|
||||||
sameDay: 'h:mm A',
|
|
||||||
lastDay: '[Yesterday]',
|
|
||||||
lastWeek: 'ddd',
|
|
||||||
sameElse: 'D MMM',
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue