Код: Выделить всё
const start = dayjs("2025-10-10");
const end = dayjs("2026-01-02");
Пример:
Код: Выделить всё
const start = dayjs("2025-10-10");
const end = dayjs("2026-01-02");
// Result
["2025-10-01", "2025-11-01", "2025-12-01", "2026-01-01"]
Код: Выделить всё
const getMonthsInRange = (startDate, endDate) => {
const dates = [];
const currentDate = new Date(startDate);
while (currentDate (
{dayjs(m).startOf("month").format("YYYY-MM-DD")}
))
Код: Выделить всё
["2022-07-01", "2022-08-01", "2022-09-01"]Подробнее здесь: https://stackoverflow.com/questions/798 ... -two-dates
Мобильная версия