added proper date

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

View File

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

View File

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