laydate组件的时间区间选择框设置方法

laydate设置起始时间结束时间, 起始时间不能大于结束时间

html



JS

   //开始时间时间
    var start = laydate.render({
        elem: '#startDate',
        min: '1900-1-1 00:00:00',
        max: '2099-6-16 23:59:59',
        trigger: 'click', //采用click弹出
        done: function (value, date, endDate) {
            end.config.min = {
                year: date.year,
                month: date.month - 1,
                date: date.date,
                hours: date.hours,
                minutes: date.minutes,
                seconds: date.seconds
            }; //开始日选好后,重置结束日的最小日期
            end.config.value = {
                year: date.year,
                month: date.month - 1,
                date: date.date,
                hours: date.hours,
                minutes: date.minutes,
                seconds: date.seconds
            }; //将结束日的初始值设定为开始日
        }
    });


    //结束时间
    var end = laydate.render({
        elem: '#endDate',
        min: '1900-1-1 00:00:00',
        max: '2099-6-16 23:59:59',
        trigger: 'click', //采用click弹出
        done: function (value, date, endDate) {
            start.config.max = {
                year: date.year,
                month: date.month - 1,
                date: date.date,
                hours: date.hours,
                minutes: date.minutes,
                seconds: date.seconds
            }; //结束日选好后,重置开始日的最大日期
        }
    });

你可能感兴趣的:(laydate组件的时间区间选择框设置方法)