Debian Codegraph @

index.d.ts

raw symbols SCIP
1 // Created on the basis of http://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-d-ts.html
2
3 export as namespace weekstart;
4
5 export type DayOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;
6
7 /**
8 * Return first day of week for country/region code.
9 *
10 * Based on data from:
11 * - [https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html](https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html)
12 * - [https://www.iso.org/iso-3166-country-codes.html](https://www.iso.org/iso-3166-country-codes.html)
13 *
14 * @example
15 * getWeekStartByRegion('PNG'); // 1
16 * getWeekStartByRegion('qa'); // 6
17 * getWeekStartByRegion(462); // 5
18 *
19 * @param {number | string} regionCode
20 * ISO 3166 Alpha-2, Alpha-3 or numeric code.
21 * @return {number}
22 * Code of first day of week for the given country/region code:
23 * 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday.
24 */
25 export function getWeekStartByRegion(
26 regionCode: number | string
27 ): DayOfWeek;
28
29 /**
30 * Return first day of week for locale identifier.
31 *
32 * Based on data from:
33 * - [https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_language_information.html](https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_language_information.html)
34 * - [https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/language_territory_information.html](https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/language_territory_information.html)
35 * - [https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html](https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html)
36 * - [http://www.unicode.org/reports/tr35/tr35.html#Unicode_Language_and_Locale_Identifiers](http://www.unicode.org/reports/tr35/tr35.html#Unicode_Language_and_Locale_Identifiers)
37 *
38 * @example
39 * getWeekStartByLocale('no'); // 1
40 * getWeekStartByLocale('Pa_Guru'); // 0
41 * getWeekStartByLocale('fr-DZ'); // 6
42 *
43 * @param {string} locale
44 * Locale identifier.
45 * @return {number}
46 * Code of first day of week for the given locale identifier:
47 * 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday.
48 */
49 export function getWeekStartByLocale(
50 locale: string
51 ): DayOfWeek;