All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.bower_components.angular-moment.angular-moment.min.js Maven / Gradle / Ivy


"format amd";(function(){function c(e){return angular.isUndefined(e)||e===null}function d(){try{return require("moment")}catch(f){throw new Error("Please install moment via npm. Please reference to: https://github.com/urish/angular-moment")}}function b(e,f){if(typeof f==="undefined"){if(typeof require==="function"){f=d()}else{throw new Error("Moment cannot be found by angular-moment! Please reference to: https://github.com/urish/angular-moment")}}e.module("angularMoment",[]).constant("angularMomentConfig",{preprocess:null,timezone:null,format:null,statefulFilters:true}).constant("moment",f).constant("amTimeAgoConfig",{withoutSuffix:false,serverTime:null,titleFormat:null,fullDateThreshold:null,fullDateFormat:null,fullDateThresholdUnit:"day"}).directive("amTimeAgo",["$window","moment","amMoment","amTimeAgoConfig",function(j,h,g,i){return function(l,n,B){var A=null;var s;var p=i.withoutSuffix;var v=i.titleFormat;var q=i.fullDateThreshold;var D=i.fullDateFormat;var z=i.fullDateThresholdUnit;var m=new Date().getTime();var x=B.amTimeAgo;var o;var C=("TIME"===n[0].nodeName.toUpperCase());var y=!n.attr("title");function w(){var G;if(o){G=o}else{if(i.serverTime){var F=new Date().getTime();var E=F-m+i.serverTime;G=h(E)}else{G=h()}}return G}function u(){if(A){j.clearTimeout(A);A=null}}function t(H){var E=w().diff(H,z);var F=q&&E>=q;if(F){n.text(H.format(D))}else{n.text(H.from(w(),p))}if(v&&y){n.attr("title",H.format(v))}if(!F){var G=Math.abs(w().diff(H,"minute"));var I=3600;if(G<1){I=1}else{if(G<60){I=30}else{if(G<180){I=300}}}A=j.setTimeout(function(){t(H)},I*1000)}}function k(E){if(C){n.attr("datetime",E)}}function r(){u();if(s){var E=g.preprocessDate(s);t(E);k(E.toISOString())}}l.$watch(x,function(E){if(c(E)||(E==="")){u();if(s){n.text("");k("");s=null}return}s=E;r()});if(e.isDefined(B.amFrom)){l.$watch(B.amFrom,function(E){if(c(E)||(E==="")){o=null}else{o=h(E)}r()})}if(e.isDefined(B.amWithoutSuffix)){l.$watch(B.amWithoutSuffix,function(E){if(typeof E==="boolean"){p=E;r()}else{p=i.withoutSuffix}})}B.$observe("amFullDateThreshold",function(E){q=E;r()});B.$observe("amFullDateFormat",function(E){D=E;r()});B.$observe("amFullDateThresholdUnit",function(E){z=E;r()});l.$on("$destroy",function(){u()});l.$on("amMoment:localeChanged",function(){r()})}}]).service("amMoment",["moment","$rootScope","$log","angularMomentConfig",function(k,g,j,h){var i=null;this.changeLocale=function(m,n){var l=k.locale(m,n);if(e.isDefined(m)){g.$broadcast("amMoment:localeChanged")}return l};this.changeTimezone=function(l){if(k.tz&&k.tz.setDefault){k.tz.setDefault(l);g.$broadcast("amMoment:timezoneChanged")}else{j.warn("angular-moment: changeTimezone() works only with moment-timezone.js v0.3.0 or greater.")}h.timezone=l;i=l};this.preprocessDate=function(l){if(i!==h.timezone){this.changeTimezone(h.timezone)}if(h.preprocess){return h.preprocess(l)}if(!isNaN(parseFloat(l))&&isFinite(l)){return k(parseInt(l,10))}return k(l)}}]).filter("amParse",["moment",function(g){return function(h,i){return g(h,i)}}]).filter("amFromUnix",["moment",function(g){return function(h){return g.unix(h)}}]).filter("amUtc",["moment",function(g){return function(h){return g.utc(h)}}]).filter("amUtcOffset",["amMoment",function(g){function h(i,j){return g.preprocessDate(i).utcOffset(j)}return h}]).filter("amLocal",["moment",function(g){return function(h){return g.isMoment(h)?h.local():null}}]).filter("amTimezone",["amMoment","angularMomentConfig","$log",function(h,i,j){function g(m,l){var k=h.preprocessDate(m);if(!l){return k}if(k.tz){return k.tz(l)}else{j.warn("angular-moment: named timezone specified but moment.tz() is undefined. Did you forget to include moment-timezone.js ?");return k}}return g}]).filter("amCalendar",["moment","amMoment","angularMomentConfig",function(i,g,h){function j(n,m,k){if(c(n)){return""}var l=g.preprocessDate(n);return l.isValid()?l.calendar(m,k):""}j.$stateful=h.statefulFilters;return j}]).filter("amDifference",["moment","amMoment","angularMomentConfig",function(j,g,h){function i(p,m,n,k){if(c(p)){return""}var l=g.preprocessDate(p);var o=!c(m)?g.preprocessDate(m):j();if(!l.isValid()||!o.isValid()){return""}return l.diff(o,n,k)}i.$stateful=h.statefulFilters;return i}]).filter("amDateFormat",["moment","amMoment","angularMomentConfig",function(j,g,h){function i(l,m){if(c(l)){return""}var k=g.preprocessDate(l);if(!k.isValid()){return""}return k.format(m)}i.$stateful=h.statefulFilters;return i}]).filter("amDurationFormat",["moment","angularMomentConfig",function(i,g){function h(j,l,k){if(c(j)){return""}return i.duration(j,l).humanize(k)}h.$stateful=g.statefulFilters;return h}]).filter("amTimeAgo",["moment","amMoment","angularMomentConfig",function(j,h,i){function g(l,m,o){var k,n;if(c(l)){return""}l=h.preprocessDate(l);k=j(l);if(!k.isValid()){return""}n=j(o);if(!c(o)&&n.isValid()){return k.from(n,m)}return k.fromNow(m)}g.$stateful=i.statefulFilters;return g}]).filter("amSubtract",["moment","angularMomentConfig",function(i,h){function g(l,j,k){if(c(l)){return""}return i(l).subtract(parseInt(j,10),k)}g.$stateful=h.statefulFilters;return g}]).filter("amAdd",["moment","angularMomentConfig",function(h,g){function i(l,j,k){if(c(l)){return""}return h(l).add(parseInt(j,10),k)}i.$stateful=g.statefulFilters;return i}]).filter("amStartOf",["moment","angularMomentConfig",function(i,h){function g(k,j){if(c(k)){return""}return i(k).startOf(j)}g.$stateful=h.statefulFilters;return g}]).filter("amEndOf",["moment","angularMomentConfig",function(i,g){function h(k,j){if(c(k)){return""}return i(k).endOf(j)}h.$stateful=g.statefulFilters;return h}]);return"angularMoment"}var a=window&&window.process&&window.process.type;if(typeof define==="function"&&define.amd){define(["angular","moment"],b)}else{if(typeof module!=="undefined"&&module&&module.exports&&(typeof require==="function")&&!a){module.exports=b(require("angular"),require("moment"))}else{b(angular,(typeof global!=="undefined"?global:window).moment)}}})();

 




© 2015 - 2024 Weber Informatics LLC | Privacy Policy