Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQuery UI Datepicker中的选取日期范围_Javascript_Jquery_Css_Jquery Ui_Datepicker - Fatal编程技术网

Javascript jQuery UI Datepicker中的选取日期范围

Javascript jQuery UI Datepicker中的选取日期范围,javascript,jquery,css,jquery-ui,datepicker,Javascript,Jquery,Css,Jquery Ui,Datepicker,我正在开发一个使用jQueryUIDatePicker的站点,问题是当用户使用ainglejQueryUIDatePicker选择开始日期和结束日期时,我必须选择所有日期并将其放入数组中 我查看了jQueryUI文档,但没有找到解决问题的方法 我希望日期范围像这样拾取 我必须使用jQuery UI,因此任何有用的想法都将受到欢迎 谢谢您可以使用此方法: 1.用户单击2个日期 2.将它们保存为两个变量(startDate、endDate) 3.你做一个循环: var numberOfDaysTo

我正在开发一个使用jQueryUIDatePicker的站点,问题是当用户使用
aingle
jQueryUIDatePicker选择开始日期和结束日期时,我必须选择所有日期并将其放入数组中

我查看了jQueryUI文档,但没有找到解决问题的方法

我希望日期范围像这样拾取

我必须使用jQuery UI,因此任何有用的想法都将受到欢迎


谢谢

您可以使用此方法:

1.用户单击2个日期

2.将它们保存为两个变量(startDate、endDate)

3.你做一个循环:

var numberOfDaysToAdd=0
var startDate;
var endDate;
var dateCheck=startDate;
var DatetoAddInArray = startDate;
var  array = [];
while(DatetoAddInArray!=endDate){
    //every time you check if the date is equal to the endDate
    //if  is not you add it in the array with the dates and then
    //you increase the index.
    //the while loop ends when you find the end  Date
    //You can change your code to add or not the start and the end dates
    numberOfDaysToAdd++;
    DatetoAddInArray.setDate(DatetoAddInArray.getDate()+numberOfDaysToAdd);
    array[numberOfDaysToAdd-1]=DatetoAddInArray;
 }
以上是存储从开始日期到结束日期的所有日期的简单方法

(!)如果日期选择器允许用户单击开始日期,然后单击开始日期之前的结束日期,则必须向用户发出警告消息,以选择正确的范围


谢谢。

您可以使用以下方法:

1.用户单击2个日期

2.将它们保存为两个变量(startDate、endDate)

3.你做一个循环:

var numberOfDaysToAdd=0
var startDate;
var endDate;
var dateCheck=startDate;
var DatetoAddInArray = startDate;
var  array = [];
while(DatetoAddInArray!=endDate){
    //every time you check if the date is equal to the endDate
    //if  is not you add it in the array with the dates and then
    //you increase the index.
    //the while loop ends when you find the end  Date
    //You can change your code to add or not the start and the end dates
    numberOfDaysToAdd++;
    DatetoAddInArray.setDate(DatetoAddInArray.getDate()+numberOfDaysToAdd);
    array[numberOfDaysToAdd-1]=DatetoAddInArray;
 }
以上是存储从开始日期到结束日期的所有日期的简单方法

(!)如果日期选择器允许用户单击开始日期,然后单击开始日期之前的结束日期,则必须向用户发出警告消息,以选择正确的范围


谢谢。

我像这样创建了
datepicker
,所以不需要更多的答案谢谢

这里正在工作


我像这样创建了
datepicker
,所以不需要更多的答案谢谢

这里正在工作