-
Notifications
You must be signed in to change notification settings - Fork 223
Expand file tree
/
Copy pathformat.d.ts
More file actions
44 lines (41 loc) · 1.51 KB
/
format.d.ts
File metadata and controls
44 lines (41 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* Returns a function that formats a given number according to the specified
* *locale*.
*
* [1]: https://tools.ietf.org/html/bcp47
*
* @param locale - a [BCP 47 language tag][1]; defaults to U.S. English.
*/
export function formatNumber(locale?: string): (i: number) => string;
/**
* Returns a function that formats a given month number (from 0 = January to 11
* = December) according to the specified *locale* and *format*.
*
* [1]: https://tools.ietf.org/html/bcp47
* [2]: https://tc39.es/ecma402/#datetimeformat-objects
*
* @param locale - a [BCP 47 language tag][1]; defaults to U.S. English.
* @param format - a [month format][2]; defaults to *short*.
*/
export function formatMonth(
locale?: string,
format?: "numeric" | "2-digit" | "long" | "short" | "narrow"
): (i: number) => string;
/**
* Returns a function that formats a given week day number (from 0 = Sunday to 6
* = Saturday) according to the specified *locale* and *format*.
*
* [1]: https://tools.ietf.org/html/bcp47
* [2]: https://tc39.es/ecma402/#datetimeformat-objects
*
* @param locale a [BCP 47 language tag][1]; defaults to U.S. English.
* @param format a [weekday format][2]; defaults to *short*.
*/
export function formatWeekday(locale?: string, format?: "long" | "short" | "narrow"): (i: number) => string;
/**
* Given a *date*, returns the shortest equivalent ISO 8601 UTC string. If the
* given *date* is not valid, returns `"Invalid Date"`.
*
* @param date a date to format
*/
export function formatIsoDate(date: Date): string;