UNPKG

@burglekitt/gmt

Version:

Temporal-based date and time utilities with timezone support and polyfill integration

26 lines (25 loc) 1.44 kB
import type { LocaleNameStyle } from "./getLocaleMonthNames.js"; /** * 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. * * @param locale BCP 47 locale tag (e.g. "en-US", "fr-FR", "ar-SA") * @param style Optional name style: `"long"` (default), `"short"`, or `"narrow"` * @returns 7-element array of weekday names from the locale's first day, or `[]` on invalid input * * @example getLocaleWeekdayNames("en-US") // ["Sunday", "Monday", ... "Saturday"] * @example getLocaleWeekdayNames("fr-FR") // ["lundi", "mardi", ... "dimanche"] * @example getLocaleWeekdayNames("de-DE", "short") // ["Mo", "Di", "Mi", ... "So"] * @example getLocaleWeekdayNames("not-a-locale") // [] */ export declare function getLocaleWeekdayNames(locale: string, style?: LocaleNameStyle): string[];