// ui import { CustomDatePicker } from "components/ui"; import { Tooltip } from "@plane/ui"; import { CalendarDays } from "lucide-react"; // helpers import { 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 ViewStartDateSelect: React.FC = ({ issue, onChange, handleOnOpen, handleOnClose, tooltipPosition = "top", className = "", noBorder = false, disabled, }) => { const maxDate = issue.target_date ? new Date(issue.target_date) : null; maxDate?.setDate(maxDate.getDate()); const today = new Date(); const startDate = new Date(issue.start_date ?? ""); const areYearsEqual = startDate.getFullYear() === today.getFullYear(); return (
{issue?.start_date ? ( <> {areYearsEqual ? renderShortDate(issue?.start_date, "_ _") : renderShortMonthDate(issue?.start_date, "_ _")} ) : ( <> Start Date )}
} handleOnClose={handleOnClose} disabled={disabled} />
); };