bootstrap Datetimepicker从当前月份删除上个月或下个月的天数

时间:2018-04-09 12:14:41

标签: datetimepicker bootstrap-datetimepicker

我想从datetimepicker日历的当前查看月份中删除上个月或下个月的日期。让你明白我的意思我附加了屏幕截图,我突然强调了我需要删除的内容

enter image description here

1 个答案:

答案 0 :(得分:2)

以下代码对您有所帮助,

  $('#datetimepicker8').datetimepicker().on('show', function(e) {
  });
.bootstrap-datetimepicker-widget table tr td.new { display: none; }
.bootstrap-datetimepicker-widget table tr td.old { visibility: hidden; } 
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/css/bootstrap-datetimepicker.min.css" />

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"></script>   
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js"></script>
<div class="container">
    <div class='col-md-6'>
        <div class="form-group">
            <div class='input-group date' id='datetimepicker8'               class="datepicker">
                <input type='text' class="form-control" />
                <span class="input-group-addon">
                    <span class="glyphicon glyphicon-calendar"></span>
                </span>
            </div>
        </div>
    </div>
    <div class='col-md-6'>
      
    </div>
</div>