export function startOfDay(baseDate = new Date()) {
  const date = new Date(baseDate);
  date.setHours(0, 0, 0, 0);
  return date;
}

export function endOfDay(baseDate = new Date()) {
  const date = new Date(baseDate);
  date.setHours(23, 59, 59, 999);
  return date;
}

export function parseReportDate(input?: string) {
  if (!input) {
    return new Date();
  }

  const value = new Date(`${input}T00:00:00`);
  return Number.isNaN(value.getTime()) ? new Date() : value;
}
