• bootstrap --datetimepicker之时间段选择


    文件引入

       <script type="text/javascript" src="css/jquery-3.2.1.js"></script>
        <link  rel="stylesheet" href="css/bootstrap.min.css" media="screen">
       <link rel="stylesheet" href="css/bootstrap-datetimepicker.css">
        <script src="https://cdn.bootcss.com/angular.js/1.4.6/angular.min.js"></script>
        <script src="dist/js/bootstrap-datetimepicker.js"></script>
       <script src="dist/js/bootstrap-datetimepicker.zh-CN.js"></script>

    HTML:

    <label>
    <input type='text' class='form-control ' id='dateBegin' name='date_begin' placeholder="beginTime..." value='' ng-model="dateBegin">
    </label>
    ---
    <label>
    <input type='text' class='form-control ' id='dateEnd' name='date_begin' placeholder="endTime..." value='' ng-model="dateEnd">
    </label>
    JS:

    function DatePicker(beginSelector,endSelector){
    $(beginSelector).datetimepicker(
    {
    language: 'zh-CN', // 语言选择中文
    autoclose: true,
    startView: 'month', // 进来是月
    minView: 'hour',// 可以看到小时
    minuteStep:1, //分钟间隔为1分
    format: 'yyyy-mm-dd hh:ii:ss',// 年月日时分秒
    clearBtn:false,
    todayBtn:true,
    endDate:new Date()
    }).on('changeDate', function(ev){
    if(ev.date){
    $(endSelector).datetimepicker('setStartDate', new Date(ev.date.valueOf()))
    }else{
    $(endSelector).datetimepicker('setStartDate',null);
    }
    })

    $(endSelector).datetimepicker(
    {
    language: "zh-CN",
    autoclose: true,
    minView: "hour",
    minuteStep:1,
    startView:'month',
    format: "yyyy-mm-dd hh:ii:ss",
    clearBtn:true,
    todayBtn:false,
    endDate:new Date()
    }).on('changeDate', function(ev){
    if(ev.date){
    $(beginSelector).datetimepicker('setEndDate', new Date(ev.date.valueOf()))
    }else{
    $(beginSelector).datetimepicker('setEndDate',new Date());
    }

    })
    }
    DatePicker("#dateBegin","#dateEnd");
    效果图



    原文:https://blog.csdn.net/qq_38643776/article/details/80851887

  • 相关阅读:
    (dp)LeetCode Weekly Contest 34 -Non-negative Integers without Consecutive Ones
    (后缀数组)poj 3581 Sequence
    (最小生成树)Codeforces 76 A Gift
    (最小生成树)Codeforces Educational Codeforces Round 9 Magic Matrix
    (AC自动机)UVALive
    (trie)BUAAOJ 371
    CCF 201312-3 最大的矩形
    http错误代码含义
    数据结构-5-二叉树的实现以及递归遍历的实现
    数据结构-3.4-栈与队列
  • 原文地址:https://www.cnblogs.com/colorful-paopao1/p/10308573.html
Copyright © 2020-2023  润新知