UNPKG

1.63 kBSource Map (JSON)View Raw
1{"version":3,"file":"difference.pipe.js","sourceRoot":"","sources":["difference.pipe.ts"],"names":[],"mappings":";AAAA,6DAA6D;;;;;;;;AAE7D,sCAAqE;AACrE,+BAAiC;AAEjC,4FAA4F;AAC5F,IAAM,iBAAiB,GAAyC,MAAO,CAAC,OAAO,IAAI,MAAM,CAAC;AAG1F;IAAA;IAWA,CAAC;IAVC,kCAAS,GAAT,UAAU,KAA2B,EAC3B,UAAgC,EAChC,IAA6B,EAC7B,SAAmB;QAE3B,IAAI,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACpC,IAAI,KAAK,GAAG,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;QAExF,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IAC3C,CAAC;IAVU,cAAc;QAD1B,WAAI,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;OAClB,cAAc,CAW1B;IAAD,qBAAC;CAAA,AAXD,IAWC;AAXY,wCAAc","sourcesContent":["/* angular2-moment (c) 2015, 2016 Uri Shaked / MIT Licence */\r\n\r\nimport {Pipe, ChangeDetectorRef, PipeTransform} from '@angular/core';\r\nimport * as moment from 'moment';\r\n\r\n// under systemjs, moment is actually exported as the default export, so we account for that\r\nconst momentConstructor: (value?: any) => moment.Moment = (<any>moment).default || moment;\r\n\r\n@Pipe({ name: 'amDifference' })\r\nexport class DifferencePipe implements PipeTransform {\r\n transform(value: Date | moment.Moment,\r\n otherValue: Date | moment.Moment,\r\n unit?: moment.unitOfTime.Diff,\r\n precision?: boolean): number {\r\n\r\n let date = momentConstructor(value);\r\n let date2 = (otherValue !== null) ? momentConstructor(otherValue) : momentConstructor();\r\n\r\n return date.diff(date2, unit, precision);\r\n }\r\n}\r\n\ninterface DecoratorInvocation {\n type: Function;\n args?: any[];\n}\n"]}
\No newline at end of file