import { ErrorMessage } from "formik"; import DatePicker from "react-datepicker"; import { Label } from "reactstrap"; import "react-datepicker/dist/react-datepicker.css"; // Define the prop types for InputDatePicker interface InputDatePickerProps { selected: Date | null; // selected should be a Date object or null onChange: (date: Date | null) => void; maxDate?: Date; minDate?: Date; name: string; ref?: React.Ref; placeholderText?: string; disabled?: boolean; label: string; errors?: Record; // errors should be a record with string keys and string values or undefined dateFormat?: string; showAsterisk?: boolean; // showAsterisk should be a boolean } const InputDatePicker = ({ selected, onChange, maxDate, minDate, name, placeholderText, disabled, label, errors, dateFormat, showAsterisk, }: InputDatePickerProps) => { console.log(errors?.[name], "errors", name); // Log the error for the specific field return (
); }; export default InputDatePicker;