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