i have a problem where the user selects a range of dates. i need to then find out what dates fall between those two selected dates. they\'re coming in via jquery with someth
You can grab the values from your date pickers using the getDate
method, since this will return you a Date object. Then, starting at the start date increment "current" date by 1 day and add it to an array until the current date is the same as the end date.
Note that you'll need to create a new Date() when adding it to the between
array, or else you will just be referencing the currentDate
object and all your values will be the same.
Working Demo
var start = $("#from").datepicker("getDate"),
end = $("#to").datepicker("getDate"),
currentDate = new Date(start.getTime()),
between = []
;
while (currentDate <= end) {
between.push(new Date(currentDate));
currentDate.setDate(currentDate.getDate() + 1);
}