UNPKG

next-timeago

Version:

React timeago component for your next React apps.

53 lines (52 loc) 1.51 kB
/// <reference types="react" /> export declare const MINUTE = 60; export declare const HOUR: number; export declare const DAY: number; export declare const WEEK: number; export declare const MONTH: number; export declare const YEAR: number; export interface Props { date: string | number | Date; live?: boolean; element?: string | React.ElementType<any>; now?: () => number; locale?: string; } export type Unit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'; export type Suffix = 'ago' | 'from now'; export type Formatter = (value: number, unit: Unit, suffix: Suffix, epochMilliseconds: number, now: () => number) => React.ReactNode; export type StringOrFn = string | ((value: number, millisDelta: number) => string) | null; export type NumberArray = [ string, string, string, string, string, string, string, string, string, string ]; export type L10nsStrings = { prefixAgo?: StringOrFn; prefixFromNow?: StringOrFn; suffixAgo?: StringOrFn; suffixFromNow?: StringOrFn; second?: StringOrFn; seconds?: StringOrFn; minute?: StringOrFn; minutes?: StringOrFn; hour?: StringOrFn; hours?: StringOrFn; day?: StringOrFn; days?: StringOrFn; week?: StringOrFn; weeks?: StringOrFn; month?: StringOrFn; months?: StringOrFn; year?: StringOrFn; years?: StringOrFn; wordSeparator?: string; numbers?: NumberArray; };