mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-29 13:52:10 +03:00
9487ff9bae
no issue - preparation for using `ember-pikaday` that utilizes `ember-cli-moment-shim` - removes usage of `moment` global - removes custom imports of `moment` and `moment-timezone` libraries
19 lines
586 B
JavaScript
19 lines
586 B
JavaScript
import {helper} from 'ember-helper';
|
|
import moment from 'moment';
|
|
|
|
export function timeAgo(params) {
|
|
if (!params || !params.length) {
|
|
return;
|
|
}
|
|
let [timeago] = params;
|
|
|
|
return moment(timeago).from(moment.utc());
|
|
}
|
|
|
|
export default helper(function (params) {
|
|
return timeAgo(params);
|
|
// 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
|
|
});
|