Grid arithmetic
The grid is derived from values you set: a day span, a slot length, and which days appear. The span is divided into rows by the slot length - 8:00 to 18:00 at 60 minutes gives 10 rows, at 30 minutes gives 20 - paired with your day columns. A monthly layout renders one cell per date of the chosen month, so February gives 28 cells.