Created
August 3, 2020 16:03
-
-
Save katepapineni/5f2a15ae9d1c0ac100a78d204b214313 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const getRange = (start, end) => { | |
const range = []; | |
const date = new Date(start); | |
const toDate = new Date(end); | |
while (date <= toDate) { | |
range.push(new Date(date)); | |
date.setDate(date.getDate() + 1); | |
} | |
return range; | |
}; | |
// What's the output? | |
console.log(getRange('2020-08-04', '2020-08-07')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment