import { endOfDay, isAfter, isBefore, startOfDay } from 'date-fns';
import { parseBase } from './index';
export default function unifiedDisabledDateFromProps(format, disabledDateProps) {
    var disabledDate;
    if (typeof disabledDateProps === 'object') {
        var _a = disabledDateProps, min_1 = _a.min, max_1 = _a.max;
        disabledDate = function (date) {
            return (!!min_1 && isBefore(endOfDay(date), parseBase(min_1, format))) ||
                (!!max_1 && isAfter(startOfDay(date), parseBase(max_1, format)));
        };
    }
    else {
        disabledDate = disabledDateProps;
    }
    return disabledDate;
}
