react-timeago
Version:
A simple Time-Ago component for ReactJs
19 lines (18 loc) • 345 B
TypeScript
import * as React from 'react'
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,
nextFormatter: Formatter,
now: () => number,
) => React.ReactNode