react-native-full-calendars
Version:
React Native Full Calendar (RNFC) is an intuitive and powerful calendar component library designed for React Native.
17 lines (16 loc) • 667 B
JavaScript
;
import { getWeeksInMonth } from './date';
import { addMonths, endOfMonth, format, isSameWeek, subMonths } from 'date-fns';
export const computedWeeksOfMonth = (date, isDisabled) => {
let weeks = getWeeksInMonth(date);
const nextMonthFirstDay = format(addMonths(date, 1), 'yyyy-MM-01');
const prevMonthLastDay = format(endOfMonth(subMonths(date, 1)), 'yyyy-MM-dd');
if (isSameWeek(date, nextMonthFirstDay) && isDisabled) {
weeks = getWeeksInMonth(nextMonthFirstDay);
}
if (isSameWeek(date, prevMonthLastDay) && isDisabled) {
weeks = getWeeksInMonth(prevMonthLastDay);
}
return weeks;
};
//# sourceMappingURL=computed-weeks.js.map