const YEARS_TO_DISPLAY = 12;
function getLocaleValue(locale) {
    switch (locale) {
        case 'fr_CA':
            return 'fr-CA';
        case 'en_CA':
        default:
            return 'en-CA';
    }
}
function getMonthName(monthNumber, locale, monthFormat = 'long') {
    const localeVal = getLocaleValue(locale);
    const date = new Date(new Date().getFullYear(), monthNumber);
    return new Intl.DateTimeFormat(localeVal, { month: monthFormat }).format(date);
}
function getDaysInMonth(month, year) {
    return new Date(year, month, 0, 4).getDate();
}
function getDays(month, year) {
    const numDays = Array.from({ length: getDaysInMonth(month + 1, year) }, (_, k) => k + 1);
    return numDays.map((num) => {
        const d = new Date(year, month, num);
        d.setHours(0, 0, 0, 0);
        return d;
    });
}
function getIsSameDay(date1, date2) {
    return (date1.getFullYear() === date2.getFullYear() &&
        date1.getMonth() === date2.getMonth() &&
        date1.getDate() === date2.getDate());
}
function getIsToday(date) {
    return getIsSameDay(new Date(), date);
}
function subDays(date, days) {
    date.setHours(0, 0, 0, 0);
    const d = new Date(date);
    return new Date(d.setDate(d.getDate() - days));
}
function getFirstDayOfMonth(year, month) {
    return new Date(year, month, 1);
}
function getLastDayOfMonth(year, month) {
    return new Date(year, month + 1, 0);
}
function isInDateRange(dateRange, day) {
    day.setHours(0, 0, 0, 0);
    const start = new Date(dateRange.start.setHours(0, 0, 0, 0));
    const end = new Date(dateRange.end.setHours(0, 0, 0, 0));
    return day >= start && day <= end;
}
function formatDate(date, locale, variant) {
    const d = date.getDate();
    const day = d < 10 ? `0${d}` : d;
    const month = date.getMonth() + 1;
    const year = date.getFullYear();
    switch (variant) {
        case 'select':
            return `${day}/${month}/${year}`;
        case 'chip':
        default:
            return new Intl.DateTimeFormat(locale === 'fr_CA' ? 'fr-CA' : 'en-CA', {
                dateStyle: 'medium',
            }).format(date);
    }
}

export { YEARS_TO_DISPLAY, formatDate, getDays, getDaysInMonth, getFirstDayOfMonth, getIsSameDay, getIsToday, getLastDayOfMonth, getMonthName, isInDateRange, subDays };
