UNPKG

5.64 kBTypeScriptView Raw
1export interface LocaleOptionsFormat {
2 format: string[];
3 standalone: string[];
4 isFormat?: RegExp;
5}
6export declare type LocaleOptions = string[] | LocaleOptionsFormat;
7export declare const defaultLocaleMonths: string[];
8export declare const defaultLocaleMonthsShort: string[];
9export declare const defaultLocaleWeekdays: string[];
10export declare const defaultLocaleWeekdaysShort: string[];
11export declare const defaultLocaleWeekdaysMin: string[];
12export declare const defaultLongDateFormat: {
13 [index: string]: string;
14};
15export declare const defaultOrdinal = "%d";
16export declare const defaultDayOfMonthOrdinalParse: RegExp;
17export declare type OrdinalDateFn = (num: number, token?: string) => string;
18export declare type PluralizeDateFn = (num: number, withoutSuffix: boolean, key?: string, isFuture?: boolean) => string;
19export interface LocaleData {
20 abbr?: string;
21 parentLocale?: string;
22 months?: LocaleOptions | ((date: Date, format: string, isUTC?: boolean) => string | string[]);
23 monthsShort?: LocaleOptions | ((date: Date, format: string, isUTC?: boolean) => string | string[]);
24 monthsParseExact?: boolean;
25 weekdays?: LocaleOptions | ((date: Date, format: string, isUTC?: boolean) => string | string[]);
26 weekdaysShort?: string[] | ((date: Date, format: string, isUTC?: boolean) => string | string[]);
27 weekdaysMin?: string[] | ((date: Date, format: string, isUTC?: boolean) => string | string[]);
28 weekdaysParseExact?: boolean;
29 longDateFormat?: {
30 [index: string]: string;
31 };
32 calendar?: {
33 [key: string]: (string | ((date: Date, now?: Date) => string) | ((dayOfWeek: number, isNextWeek: boolean) => string));
34 };
35 relativeTime?: {
36 [key: string]: string | PluralizeDateFn;
37 };
38 dayOfMonthOrdinalParse?: RegExp;
39 ordinal?: string | OrdinalDateFn;
40 week?: {
41 dow?: number;
42 doy?: number;
43 };
44 invalidDate?: string;
45 monthsRegex?: RegExp;
46 monthsParse?: RegExp[];
47 monthsShortRegex?: RegExp;
48 monthsStrictRegex?: RegExp;
49 monthsShortStrictRegex?: RegExp;
50 longMonthsParse?: RegExp[];
51 shortMonthsParse?: RegExp[];
52 meridiemParse?: RegExp;
53 meridiemHour?(hour: number, meridiem: string): number;
54 preparse?(str: string, format?: string | string[]): string;
55 postformat?(str: string | number): string;
56 meridiem?(hour: number, minute?: number, isLower?: boolean): string;
57 isPM?(input: string): boolean;
58 getFullYear?(date: Date, isUTC: boolean): number;
59}
60export declare class Locale {
61 parentLocale?: Locale;
62 _abbr: string;
63 _config: LocaleData;
64 meridiemHour: (hour: number, meridiem: string) => number;
65 _invalidDate: string;
66 _week: {
67 dow: number;
68 doy: number;
69 };
70 _dayOfMonthOrdinalParse: RegExp;
71 _ordinalParse: RegExp;
72 _meridiemParse: RegExp;
73 private _calendar;
74 private _relativeTime;
75 private _months;
76 private _monthsShort;
77 private _monthsRegex;
78 private _monthsShortRegex;
79 private _monthsStrictRegex;
80 private _monthsShortStrictRegex;
81 private _monthsParse;
82 private _longMonthsParse;
83 private _shortMonthsParse;
84 private _monthsParseExact;
85 private _weekdaysParseExact;
86 private _weekdaysRegex;
87 private _weekdaysShortRegex;
88 private _weekdaysMinRegex;
89 private _weekdaysStrictRegex;
90 private _weekdaysShortStrictRegex;
91 private _weekdaysMinStrictRegex;
92 private _weekdays;
93 private _weekdaysShort;
94 private _weekdaysMin;
95 private _weekdaysParse;
96 private _minWeekdaysParse;
97 private _shortWeekdaysParse;
98 private _fullWeekdaysParse;
99 private _longDateFormat;
100 private _ordinal;
101 constructor(config: LocaleData);
102 set(config: LocaleData): void;
103 calendar(key: string, date: Date, now: Date): string;
104 longDateFormat(key: string): string;
105 get invalidDate(): string;
106 set invalidDate(val: string);
107 ordinal(num: number, token?: string): string;
108 preparse(str: string, format?: string | string[]): string;
109 getFullYear(date: Date, isUTC?: boolean): number;
110 postformat(str: string): string;
111 relativeTime(num: number, withoutSuffix: boolean, str: 'future' | 'past', isFuture: boolean): string;
112 pastFuture(diff: number, output: string): string;
113 /** Months */
114 months(): string[];
115 months(date: Date, format?: string, isUTC?: boolean): string;
116 monthsShort(): string[];
117 monthsShort(date?: Date, format?: string, isUTC?: boolean): string;
118 monthsParse(monthName: string, format?: string, strict?: boolean): number;
119 monthsRegex(isStrict: boolean): RegExp;
120 monthsShortRegex(isStrict: boolean): RegExp;
121 /** Week */
122 week(date: Date, isUTC?: boolean): number;
123 firstDayOfWeek(): number;
124 firstDayOfYear(): number;
125 /** Day of Week */
126 weekdays(): string[];
127 weekdays(date: Date, format?: string, isUTC?: boolean): string;
128 weekdaysMin(): string[];
129 weekdaysMin(date: Date, format?: string, isUTC?: boolean): string;
130 weekdaysShort(): string[];
131 weekdaysShort(date: Date, format?: string, isUTC?: boolean): string;
132 weekdaysParse(weekdayName?: string, format?: string, strict?: boolean): number;
133 weekdaysRegex(isStrict: boolean): RegExp;
134 weekdaysShortRegex(isStrict?: boolean): RegExp;
135 weekdaysMinRegex(isStrict?: boolean): RegExp;
136 isPM(input: string): boolean;
137 meridiem(hours: number, minutes: number, isLower: boolean): string;
138 formatLongDate(key: string): string;
139 private handleMonthStrictParse;
140 private handleWeekStrictParse;
141 private computeMonthsParse;
142 private computeWeekdaysParse;
143}