Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
Merge 27e1ad3 into f1d4090
Browse files Browse the repository at this point in the history
  • Loading branch information
ronky committed Jul 18, 2015
2 parents f1d4090 + 27e1ad3 commit 487f084
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions angular-moment.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,32 @@
amTimeAgoFilter.$stateful = angularMomentConfig.statefulFilters;

return amTimeAgoFilter;
}])

/**
* @ngdoc filter
* @name angularMoment.filter:amTimeToNow
* @module angularMoment
* @function
*/
.filter('amTimeToNow', ['moment', 'amMoment', 'angularMomentConfig', function (moment, amMoment, angularMomentConfig) {
function amTimeToNowFilter(value, preprocess, suffix) {
if (typeof value === 'undefined' || value === null) {
return '';
}

value = amMoment.preprocessDate(value, preprocess);
var date = moment(value);
if (!date.isValid()) {
return '';
}

return amMoment.applyTimezone(date).toNow(suffix);
}

amTimeToNowFilter.$stateful = angularMomentConfig.statefulFilters;

return amTimeToNowFilter;
}]);
}

Expand Down

0 comments on commit 487f084

Please sign in to comment.