如何在使用 datetimepicker 时显示接下来的 7 天?

How to show next 7 days while using datetimepicker?

function getNext7WorkingDays(){
    var d = new Date();
    var day = d.getDay();
    if(day>=0 && day<=3) return 9;
    else if(day!=6) return 10;
    else return 11;
}
$('.datepicker_quiz_dataa').datetimepicker({
    timepicker:false,
    format:'d-m-Y',
    formatDate:'Y/m/d',
    minDate: 1,
    maxDate: '+'+getNext7WorkingDays()+'D'
});

在这段代码中,我使用了 datetimepicker,其中我只获取 d-m-y 格式的日期,我希望它仅显示接下来 7 天的当前日期,但现在我获取的是前 14 天的日期。那么,我该怎么做呢?请帮助我。

谢谢

希望对您有所帮助

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>datepicker demo</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.12.4.js"></script>
  <script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
</head>
<body>
 
<div id="datepicker"></div>
 
<script>
$( "#datepicker").datepicker({
  minDate: 0,
  maxDate: 6,
  dateFormat: "d-m-y",
  onSelect : function(r) { console.log(r) }
});
</script>
 
</body>
</html>

试试下面这个:

$('.datepicker_quiz_dataa').datepicker({ 
       minDate: 0,
       maxDate: "7d",
       dateFormat: "d-m-y"
});

$('.datepicker_quiz_dataa').datepicker({ 
      minDate: 0,
      maxDate: "1w",
      dateFormat: "d-m-y"
});