Layui时间选择器

http://www.layui.com/laydate/skins.html

 

$(document).ready(function () {
  
        var date = new Date;
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        var day = date.getDate();
        month = (month < 10 ? "0" + month : month);
        day = (day < 10 ? "0" + day : day);
        var mydate = (year.toString() + "-" + month.toString() + "-" + day.toString() + " " + "00:00:00");

        var start = {
            elem: '#start', //id为star的输入框
            format: 'YYYY-MM-DD hh:mm:ss',
            max: laydate.now(), //最大日期
            istime: true,
            start: laydate.now(),
            istoday: false,
            max: laydate.now(),
            choose: function (datas) {
                end.min = datas;
                $("#end").attr("disabled", false);
                alert($("#ss").val());
            }
        };
        var end = {
            elem: '#end',
            format: 'YYYY-MM-DD hh:mm:ss',
            max: laydate.now(),
            istime: true,
            start: laydate.now(),
            istoday: false,
            max: laydate.now(),
        };
        laydate(start);
        laydate(end);
        $("#start").val(mydate.toString());     //赋予默认值
        $("#end").val(mydate.toString());       //赋予默认值

   
})
@Html.DropDownList("F_RealName", ViewData["Name"] as SelectList, "请选择操作员", new { @style = "float:right;",@id="operator" })
                <input class="laydate-icon" name="end_time" value="" style="float:right;" placeholder="请选择结束日期" id="end" type="text" disabled="disabled">
                <input class="laydate-icon" name="begin_time" value="" style="float:right;" placeholder="请选择开始日期" id="start" type="text">                

 

 

<script src="~/Content/js/SelectTime/laydate.js" type="text/javascript"></script>
<input class="layui-input" placeholder="自定义日期格式" onclick="laydate({istime: true,format: 'YYYY-MM-DD hh:mm:ss'})">

 

elem: obj, //需显示日期的元素选择器
event: 'click', //触发事件
format: 'YYYY-MM-DD hh:mm:ss', //日期格式
istime: true, //是否开启时间选择
isclear: true, //是否显示清空
istoday: true, //是否显示今天
issure: true, //是否显示确认
festival: true, //是否显示节日
min: '2016-01-01 23:59:59', //最小日期laydate.now()
max: '2099-12-31 23:59:59', //最大日期
start: laydate.now(), //开始日期laydate.now()
fixed: false, //是否固定在可视区域
zIndex: 99999999, //css z-index
choose: function(dates){ //选择好日期的回调

 

posted @ 2017-07-27 17:20  XinYiBuFang  阅读(2183)  评论(0编辑  收藏  举报