当前位置:Gxlcms > JavaScript > JS 替换和时间插件的结合使用方法

JS 替换和时间插件的结合使用方法

时间:2021-07-01 10:21:17 帮助过:2人阅读


[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

代码如下:
// 日期
    $('.date').datepicker({
        changeYear: true,
        changeMonth: true,
        minDate:null,
        maxDate:null,
        onClose: function(selectedDate) {
            $('.gap-date').datepicker('option','minDate', '+1m');
        }
    });

    // 日期范围
    $('.gap-date').datepicker({
        changeYear: true,
        changeMonth: true,
        maxDate:null,
        onClose: function(selectedDate) {
            var y, m, d;
            var arr = selectedDate.split('-');
            y = arr[0];
            m = arr[1] - 7;
            d = arr[2];
            $('.date').datepicker('option','maxDate', new Date(y, m, d));
        }
    });

人气教程排行