import moment from 'moment-timezone';

export function getDaysInWeek(dateString?: string, daysToShow = 5) {
  dateString = dateString || moment().format('DD/MM/YYYY');
  const date = moment(dateString, 'DD/MM/YYYY');
  const start = moment(date).startOf('week');
  const days: { value: string; label: string }[] = [];
  for (let i = 0; i < daysToShow; i++) {
    const newDate = moment(start).add(i, 'days');
    days.push({
      value: newDate.format('DD/MM/YYYY'),
      label: newDate.format('ddd'),
    });
  }
  return days;
}
