UNPKG

intl-dateformat

Version:

Format a date using Intl.DateTimeFormat goodness.

23 lines (22 loc) 923 B
export declare type DatePartName = 'weekday' | 'year' | 'month' | 'lmonth' | 'day' | 'dayPeriod' | 'hour' | 'lhour' | 'minute' | 'second'; export declare type DateParts = { [k in DatePartName]: string; }; export declare type Token = { type: DatePartName | 'literal'; value: string; }; export declare type Parser = (date: Date) => DateParts; export declare type FormatterMask = 'YYYY' | 'YY' | 'MMMM' | 'MMM' | 'MM' | 'DD' | 'dddd' | 'ddd' | 'A' | 'a' | 'HH' | 'hh' | 'mm' | 'ss'; export declare type Formatter = (tokens: DateParts, date: Date) => string; export declare type Formatters = { [k in FormatterMask]: Formatter; }; export declare type CustomFormatters = { [k: string]: Formatter; }; export declare type FormatFunction = (date: Date, format: string, options?: FormatOptions) => string; export declare type FormatOptions = { locale?: string; timezone?: string; };