By default today's date active in daterangepicker

时间:2015-07-28 16:22:45

标签: javascript jquery daterangepicker

How to remove today's date active in predefined range of date range picker. I have used http://www.daterangepicker.com/ daterangepicker as mentioned in this link

Script

$('#reportrange').daterangepicker({

        ranges: {
            'Today': [moment(), moment()],
            'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
            'Last 7 Days': [moment().subtract(6, 'days'), moment()],
            'Last 30 Days': [moment().subtract(29, 'days'), moment()],
            'This Month': [moment().startOf('month'), moment().endOf('month')],
            'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
        }        
    }, function (start, end) {
        $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));       
    });

view
======
<div id="datepicker">

<span id="datepicker-heading">Created On</span><br />

<div id="reportrange" class="pull-right" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc;">
 <i class="glyphicon glyphicon-calendar fa fa-calendar"></i>&nbsp;
  <span>Select Date</span> <b class="caret"></b>
  </div>
  </div>

while page loading date range picker shows Select Date by default. But today is highlighted below

1 个答案:

答案 0 :(得分:0)

&#34;今天&#34;突出显示内置于daterangepicker,并且没有可用于禁用它的本机方法/参数。最简单的方法就是覆盖活动日期的默认CSS样式:

.daterangepicker td.active, .daterangepicker td.active:hover {
     background-color: #fff; 
     border-color: #fff; 
     color: #000; 
}

注意:这将防止在用户选择日期时发生任何突出显示。