diff --git a/src/components/Datepicker.tsx b/src/components/Datepicker.tsx index 54e90b78..65620920 100644 --- a/src/components/Datepicker.tsx +++ b/src/components/Datepicker.tsx @@ -132,14 +132,12 @@ const Datepicker: React.FC = ({ /* Start Second */ const secondGotoDate = useCallback( (date: dayjs.Dayjs) => { - const newDate = dayjs(formatDate(date, displayFormat)); - const reformatDate = dayjs(formatDate(firstDate, displayFormat)); - if (newDate.isSame(reformatDate) || newDate.isBefore(reformatDate)) { + if (date.isSame(firstDate) || date.isBefore(firstDate)) { setFirstDate(previousMonth(date)); } setSecondDate(date); }, - [firstDate, displayFormat] + [firstDate] ); const previousMonthSecond = useCallback(() => {