monthGridfunction
The weeks of a month: whole weeks of seven, from the week of the 1st to the week of the last day.
Import it
import { monthGrid } from "@johnmorrisdotca/koyomi-calendars/month";
Definition
function monthGrid(year: number, month: number, weekStart?: WeekStart): MonthGrid
Parameters
| Name | Type | Description |
|---|---|---|
year | number | Four-digit year. |
month | number | Month 1 to 12. |
weekStart (optional) | WeekStart | The first column, |
Returns
MonthGrid
The grid: how many days the month has, how many cells come before the 1st, and 4, 5 or 6 weeks of seven days.
Examples
import { monthGrid } from "@johnmorrisdotca/koyomi-calendars/month";
const grid = monthGrid(2026, 11, "monday");
console.log(grid.offset, grid.weeks.map((week) => week[0]!.day).join(" "));6 26 2 9 16 23 30What it prints (run when this page was built)