export const normalizeDateHours = (date: Date) => {
  date.setHours(0, 0, 0, 0);
  return date;
};

export const formatSecondsToTime = (seconds: number) => {
  if (seconds === 0) {
    return '-';
  }

  const days = Math.floor(seconds / 86400); // 86400 seconds in a day
  const hours = Math.floor((seconds % 86400) / 3600);
  const minutes = Math.floor((seconds % 3600) / 60);

  // Ensure minimum is 1m
  if (days === 0 && hours === 0 && minutes === 0) {
    return '1m';
  }

  // Build the result string with only non-zero units
  const parts = [];
  if (days > 0) parts.push(`${days}d`);
  if (hours > 0) parts.push(`${hours}h`);
  if (minutes > 0) parts.push(`${minutes}m`);

  return parts.join(' ');
};
