It looks like you can use Datejs . This is amazing.
If you are using Datejs, here is how you could do it:
function expandRange(start, end) // start and end are your two Date inputs
{
var range;
if (start.isBefore(end))
{
start = start.clone();
range = [];
while (!start.same().day(end))
{
range.push(start.clone());
start.addDays(1);
}
range.push(end.clone());
return range;
}
else
{
return expandRange(end, start);
}
}
ex. for me:
expandRange(new Date('2010-08-31'), new Date('2010-09-02'));
3 Date:
[Tue Aug 31 2010 00:00:00 GMT-0400 (Eastern Daylight Time),
Wed Sep 01 2010 00:00:00 GMT-0400 (Eastern Daylight Time),
Thu Sep 02 2010 00:00:00 GMT-0400 (Eastern Daylight Time)]