UNPKG

@intility/bifrost-react

Version:

React library for Intility's design system, Bifrost.

16 lines (15 loc) 760 B
export type DateTimeFormatterOptions = { /** Date object */ date: Date | string; /** Display either 'date' (default), 'datetime', or 'time' */ show?: "date" | "datetime" | "time"; /** Optional Intl.DateTimeFormatOptions object (overrides default bifrost format) */ options?: Intl.DateTimeFormatOptions; /** Optional Intl.LocalesArgument (overrides current bifrost locale, "en-us" or "nb-no") */ locale?: Intl.LocalesArgument; }; /** * Context-aware date and time formatter using locale and options from the current Bifrost context unless specified * @returns A function that formats a date and/or time */ export default function useDateTimeFormatter(): ({ date, show, locale, options, }: DateTimeFormatterOptions) => string;