Skip to content

Instantly share code, notes, and snippets.

@BukhariH
Created June 6, 2018 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BukhariH/f1588ea480ba3aeb46b811ebf4dd51e9 to your computer and use it in GitHub Desktop.
Save BukhariH/f1588ea480ba3aeb46b811ebf4dd51e9 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