UNPKG

@veracity/vui

Version:

Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.

19 lines (18 loc) 1.18 kB
//#region src/utils/formatDate.d.ts type DateFormat = 'DD MM YYYY' | 'DD MM YYYY, HH:MM' | 'DD MMM' | 'DD MMM YYYY' | 'DD MMM YYYY, HH:MM' | 'DD MMM, HH:MM' | 'HH:MM' | 'MMM D, YYYY' | 'YYYY/MM/DD' | 'YYYY-MM-DD' | 'YYYY/MM/DD, HH:MM' | 'YYYY-MM-DD, HH:MM' | 'YYYY-MM-DD, HH:MM:SS'; type FormatDateOptions = Intl.DateTimeFormatOptions & { locales?: string | string[]; }; /** Predefined selection of date formats using DateTimeFormatOptions. */ declare const dateFormats: Record<DateFormat, FormatDateOptions>; /** * Structures given date string, milliseconds number or Date object according to the chosen format. * Uses toLocalDateString internally. Predefined formats specify initial options, which can be overwritten. * @param date - string, number or Date object accepted by Date() constructor * @param format - predefined configuration of DateTimeFormatOptions * @param options - configuration of toLocaleDateString method */ declare function formatDate(date?: string | number | Date, format?: DateFormat, options?: FormatDateOptions): string; //#endregion export { DateFormat, FormatDateOptions, dateFormats, formatDate }; //# sourceMappingURL=formatDate.d.ts.map