Library to get first day of week.
Uses data from langRegionMap.js and regionDayMap.js.
Methods
-
<static> getWeekStartByLocale(locale)
-
Return first day of week for locale identifier.
Based on data from:
- https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_language_information.html
- https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/language_territory_information.html
- https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/territory_information.html
- http://www.unicode.org/reports/tr35/tr35.html#Unicode_Language_and_Locale_Identifiers
Parameters:
Name Type Description locale
string Locale identifier.
- Source:
- See:
Returns:
Code of first day of week for the given locale identifier: 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday.
- Type
- number
Example
getWeekStartByLocale('no'); // 1 getWeekStartByLocale('Pa_Guru'); // 0 getWeekStartByLocale('fr-DZ'); // 6
-
<static> getWeekStartByRegion(regionCode)
-
Return first day of week for country/region code.
Based on data from:
Parameters:
Name Type Description regionCode
number | string ISO 3166 Alpha-2, Alpha-3 or numeric code.
- Source:
- See:
Returns:
Code of first day of week for the given country/region code: 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday.
- Type
- number
Example
getWeekStartByRegion('PNG'); // 1 getWeekStartByRegion('qa'); // 6 getWeekStartByRegion(462); // 5