time-ago-pipe
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -132,21 +132,3 @@ (function (global, factory) { | ||
]; }; | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
var TimeAgoPipeModule = /** @class */ (function () { | ||
function TimeAgoPipeModule() { | ||
} | ||
return TimeAgoPipeModule; | ||
}()); | ||
TimeAgoPipeModule.decorators = [ | ||
{ type: core.NgModule, args: [{ | ||
declarations: [TimeAgoPipe], | ||
exports: [TimeAgoPipe], | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
TimeAgoPipeModule.ctorParameters = function () { return []; }; | ||
exports.TimeAgoPipeModule = TimeAgoPipeModule; | ||
exports.TimeAgoPipe = TimeAgoPipe; | ||
@@ -153,0 +135,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core")):"function"==typeof define&&define.amd?define(["exports","@angular/core"],t):t(e["time-ago-pipe"]={},e.ng.core)}(this,function(e,t){"use strict";var o=function(){function e(e,t){this.changeDetectorRef=e,this.ngZone=t}return e.prototype.transform=function(e){var t=this;this.removeTimer();var o=new Date(e),n=new Date,r=Math.round(Math.abs((n.getTime()-o.getTime())/1e3)),a=1e3*this.getSecondsUntilUpdate(r);this.timer=this.ngZone.runOutsideAngular(function(){return"undefined"!=typeof window?window.setTimeout(function(){t.ngZone.run(function(){return t.changeDetectorRef.markForCheck()})},a):null});var i=Math.round(Math.abs(r/60)),u=Math.round(Math.abs(i/60)),s=Math.round(Math.abs(u/24)),c=Math.round(Math.abs(s/30.416)),g=Math.round(Math.abs(s/365));return r<=45?"a few seconds ago":r<=90?"a minute ago":i<=45?i+" minutes ago":i<=90?"an hour ago":u<=22?u+" hours ago":u<=36?"a day ago":s<=25?s+" days ago":s<=45?"a month ago":s<=345?c+" months ago":s<=545?"a year ago":g+" years ago"},e.prototype.ngOnDestroy=function(){this.removeTimer()},e.prototype.removeTimer=function(){this.timer&&(window.clearTimeout(this.timer),this.timer=null)},e.prototype.getSecondsUntilUpdate=function(e){return e<60?2:e<3600?30:e<86400?300:3600},e}();o.decorators=[{type:t.Pipe,args:[{name:"timeAgo",pure:!1}]}],o.ctorParameters=function(){return[{type:t.ChangeDetectorRef},{type:t.NgZone}]};var n=function(){return function(){}}();n.decorators=[{type:t.NgModule,args:[{declarations:[o],exports:[o]}]}],n.ctorParameters=function(){return[]},e.TimeAgoPipeModule=n,e.TimeAgoPipe=o,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core")):"function"==typeof define&&define.amd?define(["exports","@angular/core"],t):t(e["time-ago-pipe"]={},e.ng.core)}(this,function(e,t){"use strict";var n=function(){function e(e,t){this.changeDetectorRef=e,this.ngZone=t}return e.prototype.transform=function(e){var t=this;this.removeTimer();var n=new Date(e),o=new Date,r=Math.round(Math.abs((o.getTime()-n.getTime())/1e3)),a=1e3*this.getSecondsUntilUpdate(r);this.timer=this.ngZone.runOutsideAngular(function(){return"undefined"!=typeof window?window.setTimeout(function(){t.ngZone.run(function(){return t.changeDetectorRef.markForCheck()})},a):null});var i=Math.round(Math.abs(r/60)),u=Math.round(Math.abs(i/60)),s=Math.round(Math.abs(u/24)),h=Math.round(Math.abs(s/30.416)),c=Math.round(Math.abs(s/365));return r<=45?"a few seconds ago":r<=90?"a minute ago":i<=45?i+" minutes ago":i<=90?"an hour ago":u<=22?u+" hours ago":u<=36?"a day ago":s<=25?s+" days ago":s<=45?"a month ago":s<=345?h+" months ago":s<=545?"a year ago":c+" years ago"},e.prototype.ngOnDestroy=function(){this.removeTimer()},e.prototype.removeTimer=function(){this.timer&&(window.clearTimeout(this.timer),this.timer=null)},e.prototype.getSecondsUntilUpdate=function(e){return e<60?2:e<3600?30:e<86400?300:3600},e}();n.decorators=[{type:t.Pipe,args:[{name:"timeAgo",pure:!1}]}],n.ctorParameters=function(){return[{type:t.ChangeDetectorRef},{type:t.NgZone}]},e.TimeAgoPipe=n,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=time-ago-pipe.umd.min.js.map |
@@ -1,2 +0,2 @@ | ||
import { Pipe, NgZone, ChangeDetectorRef, NgModule } from '@angular/core'; | ||
import { Pipe, NgZone, ChangeDetectorRef } from '@angular/core'; | ||
@@ -131,27 +131,7 @@ /** | ||
*/ | ||
class TimeAgoPipeModule { | ||
} | ||
TimeAgoPipeModule.decorators = [ | ||
{ type: NgModule, args: [{ | ||
declarations: [TimeAgoPipe], | ||
exports: [TimeAgoPipe], | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
TimeAgoPipeModule.ctorParameters = () => []; | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
/** | ||
* Generated bundle index. Do not edit. | ||
*/ | ||
export { TimeAgoPipeModule, TimeAgoPipe }; | ||
export { TimeAgoPipe }; | ||
//# sourceMappingURL=time-ago-pipe.js.map |
@@ -1,2 +0,2 @@ | ||
import { Pipe, NgZone, ChangeDetectorRef, NgModule } from '@angular/core'; | ||
import { Pipe, NgZone, ChangeDetectorRef } from '@angular/core'; | ||
/** | ||
@@ -131,27 +131,6 @@ * @fileoverview added by tsickle | ||
*/ | ||
var TimeAgoPipeModule = /** @class */ (function () { | ||
function TimeAgoPipeModule() { | ||
} | ||
return TimeAgoPipeModule; | ||
}()); | ||
TimeAgoPipeModule.decorators = [ | ||
{ type: NgModule, args: [{ | ||
declarations: [TimeAgoPipe], | ||
exports: [TimeAgoPipe], | ||
},] }, | ||
]; | ||
/** @nocollapse */ | ||
TimeAgoPipeModule.ctorParameters = function () { return []; }; | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
/** | ||
* @fileoverview added by tsickle | ||
* @suppress {checkTypes} checked by tsc | ||
*/ | ||
/** | ||
* Generated bundle index. Do not edit. | ||
*/ | ||
export { TimeAgoPipeModule, TimeAgoPipe }; | ||
export { TimeAgoPipe }; | ||
//# sourceMappingURL=time-ago-pipe.js.map |
{ | ||
"name": "time-ago-pipe", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "A really simple, lightweight Angular pipe for converting a date string into a time ago", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -26,31 +26,11 @@ # time-ago-pipe | ||
The d.ts files are included, so typings should be picked up automatically. | ||
& thanks to awesome contributors, should now be AoT friendly too. | ||
#### SystemJS | ||
in your system config file: | ||
In the @NgModule you want to use it in | ||
``` | ||
map: { | ||
'time-ago-pipe':'node_modules/time-ago-pipe', | ||
etc | ||
} | ||
import {TimeAgoPipe} from 'time-ago-pipe'; | ||
``` | ||
add "TimeAgoPipe" to your declarations | ||
``` | ||
packages: { | ||
'time-ago-pipe': {main: 'time-ago-pipe.js'}, | ||
etc | ||
} | ||
``` | ||
Then in the @NgModule you want to use it in | ||
``` | ||
import {TimeAgoPipeModule} from 'time-ago-pipe'; | ||
``` | ||
& add "TimeAgoPipeModule" to your imports | ||
``` | ||
@NgModule({ | ||
imports: [... etc ..., TimeAgoPipeModule], | ||
declarations: [AppComponent, ... etc ...], | ||
bootstrap: [AppComponent] | ||
imports: [... etc ...], | ||
declarations: [..., TimeAgoPipe, ... ] | ||
}) | ||
@@ -57,0 +37,0 @@ ``` |
@@ -1,11 +0,4 @@ | ||
import { PipeTransform, NgZone, ChangeDetectorRef, OnDestroy } from "@angular/core"; | ||
export declare class TimeAgoPipe implements PipeTransform, OnDestroy { | ||
private changeDetectorRef; | ||
private ngZone; | ||
private timer; | ||
constructor(changeDetectorRef: ChangeDetectorRef, ngZone: NgZone); | ||
transform(value: string, realTime?: boolean): string; | ||
ngOnDestroy(): void; | ||
private removeTimer(); | ||
private getSecondsUntilUpdate(seconds); | ||
} | ||
/** | ||
* Generated bundle index. Do not edit. | ||
*/ | ||
export * from './time-ago.pipe'; |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":4,"metadata":{"TimeAgoPipeModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":3,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"TimeAgoPipe"}],"exports":[{"__symbolic":"reference","name":"TimeAgoPipe"}]}]}],"members":{}},"TimeAgoPipe":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Pipe","line":1,"character":1},"arguments":[{"name":"timeAgo","pure":false}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":7,"character":40},{"__symbolic":"reference","module":"@angular/core","name":"NgZone","line":7,"character":75}]}],"transform":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"removeTimer":[{"__symbolic":"method"}],"getSecondsUntilUpdate":[{"__symbolic":"method"}]}}},"origins":{"TimeAgoPipeModule":"./time-ago.module","TimeAgoPipe":"./time-ago.pipe"},"importAs":"time-ago-pipe"} | ||
{"__symbolic":"module","version":4,"metadata":{"TimeAgoPipe":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Pipe","line":1,"character":1},"arguments":[{"name":"timeAgo","pure":false}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":7,"character":40},{"__symbolic":"reference","module":"@angular/core","name":"NgZone","line":7,"character":75}]}],"transform":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"removeTimer":[{"__symbolic":"method"}],"getSecondsUntilUpdate":[{"__symbolic":"method"}]}}},"origins":{"TimeAgoPipe":"./time-ago.pipe"},"importAs":"time-ago-pipe"} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
40570
15
424
43