Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random past date when max date is today and we type a future date. #274

Open
atharvaBelgeW opened this issue Feb 7, 2024 · 0 comments
Open

Comments

@atharvaBelgeW
Copy link

atharvaBelgeW commented Feb 7, 2024

When we type a date and have max date selected as today, the component changes the value either to previously entered date or a previous valid year.
I want it to rather change the current value to null if future value is type and throw an error as well

<DatePicker
onChange={(date) => {
setValue("dob", date ? ${date} : "");
setSelectDate(new Date(date ? ${date} : ""));
field.onChange(date);
}}
value={
selectDate
? new Date(selectDate)
: userDetailData?.date
? new Date(
userDetailData?.date
)
: undefined
}
format="MM/DD/YYYY"
placeholder="Select date of birth (MM/DD/YYYY)"
minDate={new Date("01/01/1920")}
maxDate={new Date()}
inputClass="relative w-full bg-[#DFDFDF] mt-2.5 h-14 pl-4 rounded-md font-Montserrat text-[15px] text-[#5E5E5E]"
className="custom-calendar"
arrowStyle={{ border: 0 }}
/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant