Correction in Date Ranger in Attendance Logs.

This commit is contained in:
Kartik Sharma 2025-10-10 16:36:39 +05:30
parent 9de0b1a0df
commit 44b3f842f2

View File

@ -63,19 +63,18 @@ const DateRangePicker = ({
}; };
return ( return (
<div className={`col-${sm} col-sm-${md} px-1`}> <div className={`position-relative w-auto justify-content-center`}>
<input <input
type="text" type="text"
className="form-control form-control-sm ps-2 pe-5 me-4" className="form-control form-control-sm w-100 pe-8 "
placeholder="From to End" placeholder="From to End"
id="flatpickr-range" id="flatpickr-range"
ref={inputRef} ref={inputRef}
/> />
<i <i
className="bx bx-calendar calendar-icon cursor-pointer position-relative top-50 translate-middle-y" className="bx bx-calendar calendar-icon cursor-pointer position-absolute top-50 end-0 translate-middle-y me-2 "
onClick={handleIconClick} onClick={handleIconClick}
style={{ right: "22px", bottom: "-8px" }}
/> />
</div> </div>
); );
@ -130,7 +129,7 @@ export const DateRangePicker1 = ({
mode: "range", mode: "range",
dateFormat: "d-m-Y", dateFormat: "d-m-Y",
allowInput: allowText, allowInput: allowText,
maxDate , maxDate,
onChange: (selectedDates) => { onChange: (selectedDates) => {
if (selectedDates.length === 2) { if (selectedDates.length === 2) {
const [start, end] = selectedDates; const [start, end] = selectedDates;
@ -160,19 +159,19 @@ export const DateRangePicker1 = ({
}, []); }, []);
useEffect(() => { useEffect(() => {
if (resetSignal !== undefined) { if (resetSignal !== undefined) {
if (defaultRange) { if (defaultRange) {
applyDefaultDates(); applyDefaultDates();
} else { } else {
setValue(startField, "", { shouldValidate: true }); setValue(startField, "", { shouldValidate: true });
setValue(endField, "", { shouldValidate: true }); setValue(endField, "", { shouldValidate: true });
if (inputRef.current?._flatpickr) { if (inputRef.current?._flatpickr) {
inputRef.current._flatpickr.clear(); inputRef.current._flatpickr.clear();
}
} }
} }
} }, [resetSignal, defaultRange, setValue, startField, endField]);
}, [resetSignal, defaultRange, setValue, startField, endField]);
const start = getValues(startField); const start = getValues(startField);