Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var getDateBetween = (startDate, endDate) => {
- const dates = [];
- // Strip hours minutes seconds etc.
- let currentDate = new Date(
- startDate.getFullYear(),
- startDate.getMonth(),
- startDate.getDate()
- );
- while (currentDate <= endDate) {
- var date = {
- date: currentDate
- }
- dates.push(date);
- currentDate = new Date(
- currentDate.getFullYear(),
- currentDate.getMonth(),
- currentDate.getDate() + 1, // Will increase month if over range
- );
- }
- return dates;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement