date-range-picker插件整理

公良弘毅
2023-12-01

中文网址:Date Range Picker 中文网

需要引用:

<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css"/>

html容器:

<input type="text" id="daterangepicker01">

初始化:

var locale = {
      "format": 'YYYY/MM/DD',
      "separator": "-",
      "applyLabel": "确定",
      "cancelLabel": "取消",
      "weekLabel": "W",
      "daysOfWeek": ["日", "一", "二", "三", "四", "五", "六"],
			"monthNames": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
      "firstDay": 1
      };


$('#pubDate_input').daterangepicker({
          "locale": locale,
          "singleDatePicker": true,
          "minDate": "1949/10/01"
      }, function(start, end, label) {
        //console.log('New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')');
      });

 类似资料: