UNPKG

@intility/bifrost-react

Version:

React library for Intility's design system, Bifrost.

24 lines (23 loc) 965 B
export type FormatRelativeTimeProps = { /** Date to format, either as a Date object or an ISO string */ date: Date | string; /** Optional Intl.RelativeTimeFormatOptions object */ options?: Intl.RelativeTimeFormatOptions; /** Locale to use for formatting (default "en-us") */ locale?: string; /** Disable the tooltip (default false) */ noTooltip?: boolean; }; /** * Display a relative time string (e.g. "5 minutes ago" or "in 2 hours") * based on current Bifrost locale. Includes a tooltip with the full date * and time to avoid confusion. * * @see https://bifrost.intility.com/react/formatRelativeTime * * @example * // e.g. "5 minutes ago" or "in 2 hours" depending on the date provided * <FormatRelativeTime date={dateObjectOrISOString} /> */ declare const FormatRelativeTime: ({ date, options, locale, noTooltip, }: FormatRelativeTimeProps) => import("react/jsx-runtime").JSX.Element; export default FormatRelativeTime;