Created
September 13, 2013 21:55
-
-
Save facultymatt/6556599 to your computer and use it in GitHub Desktop.
Directive to do a time ago with angular. Add "moment" : "latest" to your bower.json file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>{{poast.created | fromNow}}</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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