const CompareTime = (time1, time2 = '') => {
    const date = new Date()
    let now_time = date.getFullYear() + "-" + (date.getMonth() + 1) + '-' + date.getDate() + " " + date.getHours() + ":" + date.getMinutes();
    let timeF1 = date.getFullYear() + "-" + (date.getMonth() + 1) + '-' + date.getDate() + " " + time1;
    let timeF2 = date.getFullYear() + "-" + (date.getMonth() + 1) + '-' + date.getDate() + " " + time2;
    now_time = new Date(now_time.replace(/\-/g, "\/"));
    timeF1 = new Date(timeF1.replace(/\-/g, "\/"));
    timeF2 = new Date(timeF2.replace(/\-/g, "\/"));


    // 比较传过来的两个时间
    if (time2 && timeF1 > timeF2) {  // 首先比较time1和time2
        return true
    } else if (time1 && timeF1 > now_time) {       // 其次比较time1和当前时间
        return true
    }
    return false
}

export default CompareTime;
