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
Full TypeScript signature sourced from the util file.
API
Parameters
Input parameters accepted by this util.
- localerequiredstring
- BCP 47 locale tag. When firstDayOfWeek is omitted the function reads the locale-specific default from an internal lookup table.
- firstDayOfWeeknumber
- Explicit override (0 = Sunday, 1 = Monday, …). Takes priority over the locale table when provided.
API
Return value
The value returned by this 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
Examples
Ready-to-paste usage snippets.
Narrow weekday labels for English locale