easyui指定默认日期

easyui设置默认日期为三个月后最后一天

//加的月份addMonth
    function formatterDate(date,addMonth) {
        var year = date.getFullYear();
        var monthDate = date.getMonth() +1;
        var month = monthDate> 9?monthDate:"0"+monthDate;
        var totalMonth = monthDate + addMonth;
        if(totalMonth>12){
            month = "0"+(totalMonth - 12);
            year = year +1;
        }
        console.log(month);
        var MonthNextFirstDay = new Date(year,month, 1);
        var lastDay = new Date(MonthNextFirstDay - 86400000);
        var day = lastDay.getDate();
        console.log(year + month + day)
        return year + '-' + month + '-' + day;

    };
 $('#expireDate').datebox('setValue', formatterDate(new Date(),3));
posted @ 2020-12-08 11:02  748573200000  阅读(326)  评论(0编辑  收藏  举报