layui时间区间指定(限定一个月)

//时间选择器
layui.use('laydate', function(){
    var laydate = layui.laydate;
    var startTime=laydate.render({
        elem: '#test1',
        done:function(value,date){
            endTime.config.min={
                year:date.year,
                month:date.month-1,
                date:date.date,
            };
            endTime.config.max={
                year:date.year,
                month:date.month,
                date:date.date,
            };


        }
    });
    var endTime=laydate.render({
        elem: '#test2',
        done:function(value,date){
            startTime.config.max={
                year:date.year,
                month:date.month-1,
                date:date.date,
            };
            startTime.config.min={
                year:date.year,
                month:date.month-2,
                date:date.date,
            };
        }
    });
});

你可能感兴趣的:(js)