How to use the bpk-component-calendar.DateUtils.daysInMonth function in bpk-component-calendar

To help you get started, we’ve selected a few bpk-component-calendar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Skyscanner / backpack / packages / bpk-component-scrollable-calendar / src / BpkScrollableCalendarGridList.js View on Github external
const monthItemHeights = months.map(month => {
      const firstDayOffset = (month.getDay() + 7 - props.weekStartsOn) % 7;
      const monthLength = DateUtils.daysInMonth(
        month.getYear(),
        month.getMonth(),
      );
      const calendarGridSpaces = firstDayOffset + monthLength;
      const rowCount = Math.ceil(calendarGridSpaces / COLUMN_COUNT);
      return BASE_MONTH_ITEM_HEIGHT + ROW_HEIGHT * rowCount;
    });