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