Compare commits

...

2 Commits

1 changed files with 13 additions and 1 deletions

View File

@ -84,8 +84,20 @@ export const ModernDatePicker: React.FC<ModernDatePickerProps> = ({ label, value
}; };
const handleConfirm = () => { 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 호출
onChange(tempValue); onChange(finalValue);
setIsOpen(false); setIsOpen(false);
setSelectingType("from"); setSelectingType("from");
}; };