Here is my code snippet
1.Just for sample i have created start and end date
2.Then create one string array which hold short or long terms of weekdays
3.declare i for index maintenance
4. loop until start date meets end date
5. Simply use getDay() built-in method of javascript which returns day in number. I am just using them for Index of weekdays array
6. Simply assign them into new array.
7. finally break the loop if it reach i==7. there is not necessary to loop after 7 days.
8. Return availabledays array.
var startdate = new Date('2014-12-29');
var enddate = new Date('2015-01-02');
var weekdays={'sun','mon','tue','wed','thu','fri','sat','sun'} ;
var availabledays;
var i = 0;
while (startdate <= enddate)
{
availabledays[i]= weekdays[startdate.getDay()];
i++;
startdate.setDate(startdate.getDate() + 1);
if (i == 7)
break;
}
return availabledays;