buildMonthMatrix

Calendar
stable

Build a fixed 6-row × 7-column date matrix for the month containing the given date. The grid always has exactly 6 rows so the calendar height stays stable when navigating month-to-month.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

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

date
requis
Date
Any date inside the target month. Day precision is used to determine the first day of the month.
firstDayOfWeek
requis
number
The index of the first weekday column: 0 = Sunday, 1 = Monday, … 6 = Saturday. Controls how the grid is anchored.

API

Valeur de retour

La valeur retournée par cet util.

A 6×7 nested array of Date objects covering the visible weeks. Dates from the previous and next month fill the padding rows.

Usage

Exemples

Extraits de code prêts à coller.

Generate a January 2024 grid (Monday start)

typescript