//将当前日期转换为YYYYMMDD
export const getCurrentDate =()=> {
    const now = new Date();
    const year = now.getFullYear();
    const month = String(now.getMonth() + 1).padStart(2, '0');
    const day = String(now.getDate()).padStart(2, '0');

    return `${year}-${month}-${day}`;
}

//获取数组中日期最大的元素
export const getMaxDate=(dates)=> {
    return dates.reduce((maxDate, currentDate) => (currentDate > maxDate ? currentDate : maxDate));
}

//两个日期比较
export const compareDates =(date1, date2)=> {
    const d1 = new Date(date1);
    const d2 = new Date(date2);
    return d1 >= d2;
}

