calendar-tsx

Overflow

Count hidden events and show them on demand.

A day-grid cell fits maxEventsPerDay rows of bars. Bars in further rows are hidden, and each day they cross counts them:

Day fieldDescription
hiddenCountHidden bars crossing this day.
hasMorehiddenCount > 0, or the view's dayOverflow returned true.
eventsEvery event on the day, including hidden ones, in order.

Render a "more" control on days where hasMore is true, and show the day's events from it.

More than you loaded

If you load a limited number of events per day, the calendar cannot count the rest. Mark those days with dayOverflow, and hasMore turns on even when nothing is hidden:

export const month = dayGridView({
  period: 'month',
  maxEventsPerDay: 3,
  dayOverflow: (date: Temporal.PlainDate) => truncatedDays.has(date.toString()),
});

hiddenCount then stays 0, so label the button without a number for those days.