Skip to content

Get all dates within range in react js

function (startDate, endDate, addFn, interval) {

 addFn = addFn || Date.prototype.addDays;
 interval = interval || 1;

 var dates = [];
 var current = new Date(startDate);

 while (current <= endDate) {
  dates.push(new Date(current));
  current = addFn.call(current, interval);
 }

 return dates;

}
See also  Python code snippet - How to input a string in streamlit?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.