• 简单的layui laydate时间控件的最大值最小值


    function renderDate(option) {
        var nowTime = new Date().getTime();
        var start = layui.laydate.render({
            elem: option.startEle,
            type: option.type,
            format: 'yyyyMMdd',
            max: nowTime,
            done: function (value, date) {
                end.config.min.year = date.year;
                end.config.min.month = date.month - 1;
                end.config.min.date = date.date + 1;
            }
        });
        var end = layui.laydate.render({
            elem: option.endEle,
            type: option.type,
            format: 'yyyyMMdd',
            max: nowTime,
            done: function (value, date) {
                start.config.max.year = date.year;
                start.config.max.month = date.month - 1;
                start.config.max.date = date.date - 1;
            }
        });
    
        return {
            reset: function () {
                start.config.max.year = new Date().getFullYear();
                start.config.max.month = new Date().getMonth();
                start.config.max.date = new Date().getDate();
                end.config.max.year = new Date().getFullYear();
                end.config.max.month = new Date().getMonth();
                end.config.max.date = new Date().getDate();
    
                start.config.min.year = '';
                start.config.min.month = '';
                start.config.min.date = '';
                end.config.min.year = '';
                end.config.min.month = '';
                end.config.min.date = '';
            }
        }
    }

    var callObj = renderDate({
            startEle: '#startDate',
            endEle: '#endDate',
            type: 'date',
        })
    
        $('#reset').click(function () {
            callObj.reset();
        })
  • 相关阅读:
    pionter指针小结
    C++笔记 5
    C++笔记 3
    ipad safari 滚动(overflow)解决方案
    IE9 BUG overflow :auto 底部空白解决方案
    asp.net 导出EXCEL超高兼容(不用装Excel)
    jquery post 同步异步总结
    jquery-alert对话框
    左固定右边自适应框架
    删除Cookies
  • 原文地址:https://www.cnblogs.com/slfmeimei/p/10727723.html
Copyright © 2020-2023  润新知