getWeekdays

Commons
stable

Returns an array of 7 narrow weekday labels (single character or narrow abbreviation) for the given locale, rotated so the first element corresponds to the locale-specific (or explicit) first day of the week. Used to render calendar column headers.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

locale
requis
string
BCP 47 locale tag. When firstDayOfWeek is omitted the function reads the locale-specific default from an internal lookup table.
firstDayOfWeek
number
Explicit override (0 = Sunday, 1 = Monday, …). Takes priority over the locale table when provided.

API

Valeur de retour

La valeur retournée par cet util.

An array of 7 narrow weekday strings in the Intl 'narrow' format (e.g. 'M', 'T', 'W', …) rotated to start on the first day of the week.

Usage

Exemples

Extraits de code prêts à coller.

Narrow weekday labels for English locale

typescript