import type { FC } from "react";
import { formatDuration } from "@/shared/utils/datetime/index.js";
import "./DurationDisplay.scss";

export interface DurationDisplayProps {
  /** Flight duration in total minutes */
  minutes: number;
  /** Locale for formatting (default: "en") */
  locale?: string;
}

/**
 * Displays a flight duration in human-readable format.
 */
export const DurationDisplay: FC<DurationDisplayProps> = ({
  minutes,
  locale = "en",
}) => {
  return (
    <span className="duration">{formatDuration(minutes, locale)}</span>
  );
};
