getWeekdayNames

Calendar
stable

Returns an ordered array of localised weekday name strings for a given locale and first-day-of-week offset. The output is already rotated so the first element corresponds to firstDayOfWeek.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

locale
required
string
BCP 47 locale tag used by Intl.DateTimeFormat to format the day names.
firstDayOfWeek
required
number
Zero-based index of the first day of the week (0 = Sunday, 1 = Monday, …). The returned array is rotated accordingly.
length
'narrow' | 'short' | 'long'
'short'
Intl.DateTimeFormat weekday format: "narrow" (M), "short" (Mon), or "long" (Monday). Defaults to "short".

API

Return value

The value returned by this util.

An array of 7 localised weekday name strings, rotated so the first element matches firstDayOfWeek.

Usage

Examples

Ready-to-paste usage snippets.

Short names starting on Monday (French)

typescript