getCurrentWeek = () => {
var startOfWeek = moment().startOf("isoWeek");
var endOfWeek = moment().endOf("isoWeek");
var days = [];
var day = startOfWeek;
while (day <= endOfWeek) {
days.push(day);
day = day.clone().add(1, "d");
}
return days;
};
function getDatesIntervalStr(dates) {
const dateParts = d => ({ year: d.year(), month: d.format('MMMM') });
const start = dateParts(dates[0]);
const end = dateParts(dates[dates.length - 1]);
if (start.year !== end.year) {
return `${start.month} ${start.year} - ${end.month} ${end.year}`;
} else if (start.month !== end.month) {
return `${start.month} - ${end.month} ${end.year}`;
} else {
return `${end.month} - ${end.year}`;
}
}