2015-02-13 07:22:32 +03:00
|
|
|
import Ember from 'ember';
|
2015-08-19 14:55:40 +03:00
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
const {Helper} = Ember;
|
|
|
|
|
|
|
|
export default Helper.helper(function (params) {
|
2015-09-03 14:06:50 +03:00
|
|
|
if (!params || !params.length) {
|
2015-02-09 18:57:50 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
let [timeago] = params;
|
2015-02-09 18:57:50 +03:00
|
|
|
|
2014-03-02 18:30:35 +04:00
|
|
|
return moment(timeago).fromNow();
|
|
|
|
// stefanpenner says cool for small number of timeagos.
|
|
|
|
// For large numbers moment sucks => single Ember.Object based clock better
|
|
|
|
// https://github.com/manuelmitasch/ghost-admin-ember-demo/commit/fba3ab0a59238290c85d4fa0d7c6ed1be2a8a82e#commitcomment-5396524
|
|
|
|
});
|