react-intl
Version:
Internationalize React apps. This library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations.
29 lines • 1.11 kB
TypeScript
import * as React from 'react';
import { RelativeTimeUnit } from '@formatjs/ecma402-abstract';
import { FormatRelativeTimeOptions } from '@formatjs/intl';
export interface Props extends FormatRelativeTimeOptions {
value?: number;
unit?: RelativeTimeUnit;
updateIntervalInSeconds?: number;
children?(value: string): React.ReactChild;
}
interface State {
prevUnit?: RelativeTimeUnit;
prevValue?: number;
currentValueInSeconds: number;
}
export declare class FormattedRelativeTime extends React.PureComponent<Props, State> {
_updateTimer: any;
static displayName: string;
static defaultProps: Pick<Props, 'unit' | 'value'>;
state: State;
constructor(props: Props);
scheduleNextUpdate({ updateIntervalInSeconds, unit }: Props, { currentValueInSeconds }: State): void;
componentDidMount(): void;
componentDidUpdate(): void;
componentWillUnmount(): void;
static getDerivedStateFromProps(props: Props, state: State): Partial<State> | null;
render(): JSX.Element;
}
export default FormattedRelativeTime;
//# sourceMappingURL=relative.d.ts.map