1 const eachDayOfInterval = (start: Date, end: Date) => {
2 const endTime = end.getTime();
4 if (!(start.getTime() <= endTime)) {
5 throw new RangeError('Invalid interval');
8 const dates: Date[] = [];
10 const currentDate = new Date(start);
11 currentDate.setUTCHours(0, 0, 0, 0);
14 while (currentDate.getTime() <= endTime) {
15 dates.push(new Date(currentDate));
16 currentDate.setUTCDate(currentDate.getUTCDate() + step);
17 currentDate.setUTCHours(0, 0, 0, 0);
22 export default eachDayOfInterval;