"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useDefaultViewMonth = void 0;
/**
 * Calculates the default view date, either using selected date, current date or boundaries
 * Used when initializing, after that viewDate will be set
 * Memoized so will only recalculate when boundaries or selectedDate changes
 */
const useDefaultViewMonth = ({ boundaries, selectedDate, isStartDate }) => {
    if (selectedDate)
        return selectedDate;
    const currentDate = new Date();
    if (!boundaries)
        return currentDate;
    if (boundaries.endDate && currentDate > boundaries.endDate && !isStartDate)
        return boundaries.endDate;
    if (boundaries.startDate && currentDate > boundaries.startDate && isStartDate)
        return boundaries.startDate;
    return currentDate;
};
exports.useDefaultViewMonth = useDefaultViewMonth;
//# sourceMappingURL=useDefaultViewMonth.js.map