// ui import { CustomDatePicker } from "components/ui"; import { Tooltip } from "@plane/ui"; import { CalendarCheck } from "lucide-react"; // helpers import { findHowManyDaysLeft, renderShortDate, renderShortDateWithYearFormat, renderShortMonthDate, } from "helpers/date-time.helper"; // types import { IIssue } from "types"; type Props = { issue: IIssue; onChange: (date: string | null) => void; handleOnOpen?: () => void; handleOnClose?: () => void; tooltipPosition?: "top" | "bottom"; className?: string; noBorder?: boolean; disabled: boolean; }; export const ViewDueDateSelect: React.FC = ({ issue, onChange, handleOnOpen, handleOnClose, tooltipPosition = "top", className = "", noBorder = false, disabled, }) => { const minDate = issue.start_date ? new Date(issue.start_date) : null; minDate?.setDate(minDate.getDate()); const today = new Date(); const endDate = new Date(issue.target_date ?? ""); const areYearsEqual = endDate.getFullYear() === today.getFullYear(); return (
{issue.target_date ? ( <> {areYearsEqual ? renderShortDate(issue.target_date ?? "", "_ _") : renderShortMonthDate(issue.target_date ?? "", "_ _")} ) : ( <> Due Date )}
} minDate={minDate ?? undefined} noBorder={noBorder} handleOnOpen={handleOnOpen} handleOnClose={handleOnClose} disabled={disabled} />
); };