UNPKG

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.

54 lines (53 loc) 1.39 kB
import { InjectionToken } from '@angular/core'; /** * Represents the Time Difference in the different time units * * @public * @api */ export interface TimeDiff { seconds: number; minutes: number; hours: number; months: number; days: number; years: number; isFuture?: boolean; } /** * Function Type for the `TimeDiffGenerator` * * @public * @api */ export declare type TimeDiffGenerator = (diff: TimeDiff) => string; /** * Custom `TimeDiffGenerator` Injection Token * * @public * @api */ export declare const CUSTOM_TIME_DIFF_GENERATOR: InjectionToken<TimeDiffGenerator>; /** * Return a respective textual representation of the input, as the input is a timespan that has been passed. * * @param diff The time diff object * @public * @api */ export declare const defaultTimeDiffGenerator: TimeDiffGenerator; export declare const getPastDiffString: (diff: TimeDiff) => string; export declare const getFutureDiffString: (diff: TimeDiff) => string; /** * Provides the TimeDiffGenerator preferring a custom provider for internal usage * * @internal */ export declare const TIME_DIFF_GENERATOR: InjectionToken<TimeDiffGenerator>; /** * TimeDiff Factory * * @param seconds The time difference in seconds. Negative values are considered as a future event * @internal */ export declare const createTimeDiff: (seconds: number) => TimeDiff;