import dayjs from 'dayjs';

// 전체 월 범위 생성
export function generateMonthRange(
  startDate: string,
  endDate: string,
): string[] {
  const start = dayjs(startDate).startOf('month');
  const end = dayjs(endDate).endOf('month');
  const months: string[] = [];

  let current = start;
  while (current.isBefore(end) || current.isSame(end, 'month')) {
    months.push(current.format('YYYY-MM'));
    current = current.add(1, 'month');
  }

  return months;
}

// 전체 일 범위 생성
export function generateDayRange(startDate: string, endDate: string): string[] {
  const start = dayjs(startDate).startOf('day');
  const end = dayjs(endDate).endOf('day');
  const days: string[] = [];

  let current = start;
  while (current.isBefore(end) || current.isSame(end, 'day')) {
    days.push(current.format('YYYY-MM-DD'));
    current = current.add(1, 'day');
  }

  return days;
}
