import { formatDateTimeParts } from "../constants";

export function DateTime({ value }: { value: string | null }) {
  const parts = formatDateTimeParts(value);
  if (!parts) return <span className="muted-text">-</span>;

  return (
    <time className="datetime" dateTime={value ?? undefined} title={parts.full}>
      <span>{parts.date}</span>
      <strong>{parts.time}</strong>
    </time>
  );
}
