// @flow import * as React from 'react' import { useEffect, useState } from 'react' import dateParser from './dateParser' import defaultFormatter from './defaultFormatter' 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: () => React.Node, now: () => number, ) => React.Node export type Props = $ReadOnly<{ /** If the component should update itself over time */ live?: boolean, /** minimum amount of time in seconds between re-renders */ minPeriod?: number, /** Maximum time between re-renders in seconds. The component should update at least once every `x` seconds */ maxPeriod?: number, /** The container to render the string into. You could use a string like `span` or a custom component */ component?: string | React.ComponentType, /** * A title used for setting the title attribute if a