SOURCE

var applyDate = new Date(("2021-01-02").replace(/-/g, "/"));
var auditDate = new Date(("2021-07-02").replace(/-/g, "/"));
var nowDate = new Date();
var dateDiff = nowDate.getTime() - applyDate.getTime();
var dayDiff = Math.floor(dateDiff / (24 * 3600 * 1000));
var identification = false;
if(dayDiff > 30){
    identification = true;
}
if(nowDate.getFullYear() >= auditDate.getFullYear()){
    console.log("一"+nowDate.getFullYear())
    console.log("二"+auditDate.getFullYear())
    var years =  nowDate.getFullYear() - auditDate.getFullYear();
    var month = 0;
    var day = 0;
    if (nowDate.getMonth() >= auditDate.getMonth()){
        month = years*12 + (nowDate.getMonth() - auditDate.getMonth());
        if(month === 6){
            day = nowDate.getDay() - auditDate.getDate();
            if(day>=0){
                month = month;
            }else{
                month = month -1;
            }
        }
    }else{
        month = (years-1)*12 + (nowDate.getMonth() + 12 - auditDate.getMonth());
        if(month === 6){
            day = nowDate.getDay() - auditDate.getDate();
            if(day>=0){
                month = month;
            }else{
                month = month -1;
            }
        }
    }
    if(month<6){
        identification = true;
    }
}
if (identification == true){
}
console 命令行工具 X clear

                    
>
console