getLocaleWeekdayNames
Signature
Section titled “Signature”getLocaleWeekdayNames(locale: string, style?: LocaleNameStyle): string[]import { getLocaleWeekdayNames } from "@northguild/gmt/plain/locale";Return the 7 weekday names for a locale, ordered starting from the
- locale’s first day of the week.
- For
en-USthe array starts with Sunday; forfr-FRit starts with Monday; forar-SAit starts with Saturday — matching GMT’s existing locale-first-day convention ingetLocaleDayOfWeek/getLocaleStartOfWeek. - This ordering is consistent with
getLocaleDayOfWeek: for any valid date,getLocaleWeekdayNames(locale)[getLocaleDayOfWeek(date, locale)]is that date’s localized weekday name. - Uses the host runtime’s
Intldata viaTemporal.PlainDate, so output depends on the runtime’s ICU build. - Returns
[]iflocaleis not a valid BCP 47 tag.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
locale |
string |
BCP 47 locale tag (e.g. “en-US”, “fr-FR”, “ar-SA”) |
style |
LocaleNameStyle |
Optional name style: "long" (default), "short", or "narrow" |
Returns
Section titled “Returns”7-element array of weekday names from the locale’s first day, or [] on invalid input
Related types
Section titled “Related types”Examples
Section titled “Examples”getLocaleWeekdayNames("en-US") // ["Sunday", "Monday", ... "Saturday"]getLocaleWeekdayNames("fr-FR") // ["lundi", "mardi", ... "dimanche"]getLocaleWeekdayNames("de-DE", "short") // ["Mo", "Di", "Mi", ... "So"]getLocaleWeekdayNames("not-a-locale") // []