Skip to content

Commit

Permalink
Merge pull request #118 from KUSITMS-29th-TEAM-B/fix/#117
Browse files Browse the repository at this point in the history
fix: datepicker 복구
  • Loading branch information
ymj07168 committed May 20, 2024
2 parents 1834989 + cc67f9f commit a2c9ae6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/common/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,24 @@ interface DatePickerProps {
}

const OneDatePick: React.FC<DatePickerProps> = ({ date, setDate, style }) => {
const [startDate, setStartDate] = useState<Date | null>(new Date());

const handleDateChange = (date: Date | null) => {
if (date) {
setStartDate(date);
setDate(date);
} else {
}
};

useEffect(() => {
setStartDate(date);
}, [date]);

return (
<StyledDatePicker
isactive={date !== null}
selected={date}
isactive={startDate !== null}
selected={startDate}
onChange={handleDateChange}
closeOnScroll={true}
style={style || ""}
Expand Down

0 comments on commit a2c9ae6

Please sign in to comment.