import { customDayjs } from "../../../utils/datejs";
export var normalizeDates = function normalizeDates(param) {
    var originalDate = param.originalDate, lang = param.lang, format = param.format, includeEdgeDates = param.includeEdgeDates, min = param.min, max = param.max;
    var dateCandidate = originalDate;
    customDayjs.locale(lang);
    if (min && includeEdgeDates && min > originalDate) {
        dateCandidate = min;
    } else if (min && !includeEdgeDates && min >= originalDate) {
        dateCandidate = customDayjs(min).add(1, 'd').toDate();
    } else if (max && includeEdgeDates && max < originalDate) {
        dateCandidate = max;
    } else if (max && !includeEdgeDates && max <= originalDate) {
        dateCandidate = customDayjs(max).subtract(1, 'd').toDate();
    }
    var formattedDateCandidate = format ? customDayjs(dateCandidate).format(format) : dateCandidate.toString();
    return {
        normalizedDate: dateCandidate,
        formattedNormalizedDate: formattedDateCandidate
    };
};
