Created
October 10, 2012 14:51
-
-
Save ginotria/3866110 to your computer and use it in GitHub Desktop.
Javascript: Get Range of Dates in Array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Date.prototype.addDays = function(days) { | |
var dat = new Date(this.valueOf()); | |
dat.setDate(dat.getDate() + days); | |
return dat; | |
}; | |
function getDates(startDate, stopDate) { | |
var dateArray = []; | |
var currentDate = startDate; | |
while (currentDate <= stopDate) { | |
dateArray.push(self.formatDate(currentDate)); | |
currentDate = currentDate.addDays(1); | |
} | |
return dateArray; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment