I want to use timeago plugin to make dates look nicer. The problem is that these dates are fetched via AngularJS from the REST dynamically. So, when I attach this jQuery plu
moment.js is the best choice. I have created a generic moment filter that allow you to use any moment formatting method.
angular.module('myApp', [])
.filter('moment', [
function () {
return function (date, method) {
var momented = moment(date);
return momented[method].apply(momented, Array.prototype.slice.call(arguments, 2));
};
}
]);
Use it like
{{ date | moment:'fromNow' }}
{{ date | moment:'calendar' }}
You can checkout it in action here http://jsfiddle.net/gregwym/7207osvw/