Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
});