Skip to content

Documentation / jalali-js / buildCalendarGrid

Function: buildCalendarGrid() ​

buildCalendarGrid(system, year, month, today, selected, rules?, isHolidayDay?): CalendarGridDay[][]

Defined in: calendar-grid.ts:36

The full weeks of grid cells needed to display year/month, padded with the trailing days of the previous month and the leading days of the next month so every row is a complete week. today and selected mark the matching cells via isToday/isSelected, for a consumer to style. rules marks blocked cells via isSelectable (see isDateSelectable()), so every binding gets the same behavior from this one place. Optional isHolidayDay marks holiday cells via isHoliday without pulling holiday data into core.

Framework-agnostic on purpose: the react and vue bindings both need this exact computation, and core is the one package both already depend on, so it lives here instead of being written twice and risking drift between them.

Parameters ​

system ​

CalendarSystem

year ​

number

month ​

number

today ​

CalendarDate

selected ​

CalendarDate | null

rules? ​

SelectionRules

isHolidayDay? ​

(date) => boolean

Returns ​

CalendarGridDay[][]