"use client"; interface DDayComponentProps { targetDate: Date; label: string; } export default function DDayComponent({ targetDate, label }: DDayComponentProps) { const today = new Date(); const diffTime = targetDate.getTime() - today.getTime(); const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); const getLabel = () => { if (diffDays > 0) return `D-${diffDays}`; if (diffDays < 0) return `D+${Math.abs(diffDays)}`; return `D-Day`; }; return (
{getLabel()} {label} | {targetDate.toDateString()}
); }