export function hasSpecificTime(time?: string | null): boolean {
  const value = time?.trim();
  if (!value) return false;

  const [rawHours = "0", rawMinutes = "0", rawSeconds = "0"] = value.split(":");
  const hours = Number(rawHours);
  const minutes = Number(rawMinutes);
  const seconds = Number(rawSeconds);

  if ([hours, minutes, seconds].some(Number.isNaN)) return false;
  return hours !== 0 || minutes !== 0 || seconds !== 0;
}

export function formatSpecificTime(time?: string | null): string {
  if (!hasSpecificTime(time)) return "";
  return time!.trim().slice(0, 5);
}
