ng-time-past-pipe
Version:
Reactive textual representation of the time that has been passed between a given date and now in your Angular App.
51 lines (50 loc) • 2.01 kB
TypeScript
import { ChangeDetectorRef, OnDestroy, PipeTransform } from '@angular/core';
import { TimeDiffGenerator } from './time-diff';
import { UpdateIntervalGenerator } from './time-interval';
import { TAInput } from './time-past';
import { Observable } from 'rxjs';
import * as i0 from "@angular/core";
export declare class TimePastPipe implements PipeTransform, OnDestroy {
private readonly changeDetectorRef;
private readonly ticker;
private readonly timeDiffGenerator;
private readonly updateIntervalGenerator;
private initialSeconds;
private lastInput;
private lastSeconds;
private lastResult;
private currentPeriod;
private readonly intervalTimer;
private readonly intervalSubscription;
/**
* TimePastPipe Class Constructor
*/
constructor(changeDetectorRef: ChangeDetectorRef, ticker: Observable<number>, timeDiffGenerator: TimeDiffGenerator, updateIntervalGenerator: UpdateIntervalGenerator);
/**
* Transform anything that can be parsed to a Date in the past, to a string that represent the relative
* time that has been passed between now and this point of time.
*
* @param value A value that can be parsed to a Date in the past or future
* @param overflow Overflow to time in past when initial date was in future
* @return The textual representation of the time that has been passed between the given Date
* and the current.
*/
transform<T extends TAInput>(value: T, overflow?: boolean): string | T;
/**
* Validate the Input Value and log a warning per value when it fails
*
* @param value
* @private
*/
private isValidInput;
/**
* Clear interval ticker subscription
*/
ngOnDestroy(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<TimePastPipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<TimePastPipe, "timePast", true>;
}
/**
* @deprecated Use TimePastPipe instead
*/
export declare const NgTimePastPipePipe: typeof TimePastPipe;