Javascript jQuery UI Datepicker中的选取日期范围
我正在开发一个使用jQueryUIDatePicker的站点,问题是当用户使用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
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
,所以不需要更多的答案谢谢
这里正在工作