angular-moment
provides amTimeAgoConfig
, for specifying whether or not ago
should be displayed:
app.constant('amTimeAgoConfig', {
withoutSuffix: true
});
moment.js
allows us to define functions to format relativeTime
, and these seem to work with angular-moment
. In this example, I defined functions for seconds and minutes:
moment.lang('en', {
relativeTime: {
future: "in %s",
past: "%s ago",
s: function(number, withoutSuffix, key, isFuture) {
return number + ' sec';
},
m: "1m",
mm: function(number, withoutSuffix, key, isFuture) {
return number + 'm';
}
}
});
If you want to try the code, here it is on Plunker.