fix(frontend): ModernDatePicker 날짜 범위 자동 정렬 추가 및 조회 불가 문제 해결

This commit is contained in:
SeongHyun Kim
2026-01-22 14:44:49 +09:00
parent 57662df8cb
commit 1720b6c826

View File

@@ -84,8 +84,20 @@ export const ModernDatePicker: React.FC<ModernDatePickerProps> = ({ label, value
};
const handleConfirm = () => {
// 날짜 순서 자동 정렬
let finalValue = { ...tempValue };
if (finalValue.from && finalValue.to) {
// from이 to보다 나중이면 swap
if (finalValue.from > finalValue.to) {
const temp = finalValue.from;
finalValue.from = finalValue.to;
finalValue.to = temp;
}
}
// 확인 버튼을 눌렀을 때만 onChange 호출
onChange(tempValue);
onChange(finalValue);
setIsOpen(false);
setSelectingType("from");
};