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

Commit

Permalink
Merge 469785a into 81a346c
Browse files Browse the repository at this point in the history
  • Loading branch information
parrisvarney committed Mar 17, 2016
2 parents 81a346c + 469785a commit f006c8d
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions angular-moment.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,33 @@
* @name angularMoment.filter:amLocal
* @module angularMoment
*/
.filter('amLocal', ['moment', function (moment) {
return function (value) {
.filter('amLocal', ['moment', 'amMoment', 'angularMomentConfig', function (moment, amMoment, angularMomentConfig) {
var amLocalFn = function(value) {
return moment.isMoment(value) ? value.local() : null;
};

// Append amLocal to preprocessor so that it isn't overridden by a existing utc preprocessing
var _preprocess = angularMomentConfig.preprocess;
angularMomentConfig.preprocess = function(value) {
return amLocalFn(_preprocess(value));
};

return amLocalFn;
}])

/**
* @ngdoc filter
* @name angularMoment.filter:amLocalFormat
* @module angularMoment
*/
.filter('amLocalFormat', ['moment', function (moment) {
return function (value, format) {
if (!moment.isMoment(value)) {
return null;
}

return moment(value.local()).format(format);
};
}])

/**
Expand Down

0 comments on commit f006c8d

Please sign in to comment.