0

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

 $('#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>

4

1 回答 1

1

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

$('#Date').daterangepicker({
     "startDate": "-1m",
     "endDate": '+1m'
)};
于 2017-02-21T15:36:40.690 回答