Skip to content

Instantly share code, notes, and snippets.

Created September 13, 2013 21:55
What would you like to do?
Directive to do a time ago with angular. Add "moment" : "latest" to your bower.json file.
<p>{{poast.created | fromNow}}</p>
angular.module('app').filter('fromNow', function() {
return function(date) {
var newDate = new Date(date*1000);
return moment(newDate).fromNow();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment