如何在第一次显示月份

时间:2017-02-21 15:34:56

标签: javascript jquery bootstrap-daterangepicker

我正在使用日期范围选择器来过滤选项。在默认日期选择器中显示当前月份和下个月。但我需要上个月和当月。我怎么能这样做?

 $('#Date').daterangepicker();
<!-- Include Required Prerequisites -->
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap/3/css/bootstrap.css" />
 
<!-- Include Date Range Picker -->
<script type="text/javascript" src="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.css" />

 <div id="Date" class="col-xs-5 col-md-4 paddingNull filterImageAlign" >here select</div>

1 个答案:

答案 0 :(得分:1)

只需将其添加到您的js代码中:

$('#Date').daterangepicker({
     "startDate": "-1m",
     "endDate": '+1m'
)};