Skip to content

getLocaleMonthNames

getLocaleMonthNames(locale: string, style?: LocaleNameStyle): string[]
import { getLocaleMonthNames } from "@northguild/gmt/plain/locale";

Return the 12 Gregorian calendar-month names for a locale, in calendar

  • order (January first, December last — not alphabetical).
  • Uses the host runtime’s Intl data via Temporal.PlainDate, so output depends on the runtime’s ICU build (full-ICU runtimes localize every locale; partial-ICU runtimes fall back to English).
  • Restricted to the Gregorian calendar; non-Gregorian calendar variants are out of scope for this function.
  • 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"

12-element array of month names in calendar order, or [] on invalid input

getLocaleMonthNames("en-US") // ["January", "February", ... "December"]
getLocaleMonthNames("de-DE", "short") // ["Jan", "Feb", "Mär", ... "Dez"]
getLocaleMonthNames("fr-FR", "narrow") // ["J", "F", "M", ... "D"]
getLocaleMonthNames("not-a-locale") // []

plain/locale/getLocaleMonthNames.ts