Skip to content

Instantly share code, notes, and snippets.

@sendtomitesh
Created September 28, 2016 07:35
Show Gist options
  • Save sendtomitesh/99d64cc16aeaa9598f51f4a9f595d235 to your computer and use it in GitHub Desktop.
Save sendtomitesh/99d64cc16aeaa9598f51f4a9f595d235 to your computer and use it in GitHub Desktop.
function (startDate, endDate, addFn, interval) {
addFn = addFn || Date.prototype.addDays;
interval = interval || 1;
var retVal = [];
var current = new Date(startDate);
while (current <= endDate) {
retVal.push(new Date(current));
current = addFn.call(current, interval);
}
return retVal;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment