Skip to content

getLocaleWeekdayNames

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-US the array starts with Sunday; for fr-FR it starts with Monday; for ar-SA it starts with Saturday — matching GMT’s existing locale-first-day convention in getLocaleDayOfWeek / 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 Intl data via Temporal.PlainDate, so output depends on the runtime’s ICU build.
  • Returns [] if locale is not a valid BCP 47 tag.
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"

7-element array of weekday names from the locale’s first day, or [] on invalid input

getLocaleWeekdayNames("en-US") // ["Sunday", "Monday", ... "Saturday"]
getLocaleWeekdayNames("fr-FR") // ["lundi", "mardi", ... "dimanche"]
getLocaleWeekdayNames("de-DE", "short") // ["Mo", "Di", "Mi", ... "So"]
getLocaleWeekdayNames("not-a-locale") // []

plain/locale/getLocaleWeekdayNames.ts