2015-02-13 07:22:32 +03:00
|
|
|
import Ember from 'ember';
|
2015-02-09 18:57:50 +03:00
|
|
|
var formatTimeago = Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams */) {
|
|
|
|
if (!arr || !arr.length) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var timeago = arr[0];
|
|
|
|
|
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
|
|
|
|
});
|
2014-03-04 00:18:10 +04:00
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
export default formatTimeago;
|