Skip to content

Instantly share code, notes, and snippets.

@BukhariH
Created June 6, 2018 14:52
Show Gist options
  • Save BukhariH/94fb93b4709471b4daf7bfa495a7c141 to your computer and use it in GitHub Desktop.
Save BukhariH/94fb93b4709471b4daf7bfa495a7c141 to your computer and use it in GitHub Desktop.
Get dates between two moment objects
enumerateDaysBetweenDates = (startDate, endDate) => {
const now = startDate.clone().startOf("day");
const dates = [];
while (now.isSameOrBefore(endDate.startOf("day"))) {
dates.push(now.format("YYYY-MM-DD"));
now.add(1, "days");
}
return dates;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment