added proper date

This commit is contained in:
pramod mahajan 2025-08-07 15:50:33 +05:30
parent 597baede57
commit 1a77c26d6b
2 changed files with 17 additions and 18 deletions

View File

@ -20475,7 +20475,7 @@ li:not(:first-child) .dropdown-item,
} }
/* text-size */ /* text-size */
.text-tiny{ .text-tiny{
font-size: 10px; font-size: 13px;
} }
/* rtl:end:remove */ /* rtl:end:remove */
.text-primary { .text-primary {

View File

@ -22,23 +22,22 @@ const DatePicker = ({
}); });
useEffect(() => { useEffect(() => {
if (inputRef.current) { if (inputRef.current) {
const parsedMinDate = minDate ? new Date(minDate.split("T")[0]) : undefined; flatpickr(inputRef.current, {
dateFormat: "d-m-Y",
flatpickr(inputRef.current, { allowInput: allowText,
dateFormat: "d-m-Y", defaultDate: value
allowInput: allowText, ? flatpickr.parseDate(value, "Y-m-d")
defaultDate: value ? flatpickr.parseDate(value, "Y-m-d") : null, : null,
maxDate: maxDate, maxDate:maxDate,
minDate: parsedMinDate, minDate:new Date(minDate?.split("T")[0]) ?? null,
onChange: function (selectedDates, dateStr) { onChange: (selectedDates, dateStr) => {
onChange(dateStr); onChange(dateStr);
}, },
...rest ...rest
}); });
} }
}, [inputRef, minDate, maxDate]); }, [inputRef]);
return ( return (
<div className={` position-relative ${className}`}> <div className={` position-relative ${className}`}>