mirror of
https://github.com/danog/telegram-tt.git
synced 2025-01-22 05:11:55 +01:00
Calendar: Fix incorrect time when scheduling (#1379)
This commit is contained in:
parent
a03f4c7189
commit
b1f91c921b
@ -73,6 +73,14 @@ const CalendarModal: FC<OwnProps> = ({
|
|||||||
}
|
}
|
||||||
}, [isOpen, defaultSelectedDate, prevIsOpen]);
|
}, [isOpen, defaultSelectedDate, prevIsOpen]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isFutureMode && selectedDate.getTime() < defaultSelectedDate.getTime()) {
|
||||||
|
setSelectedDate(defaultSelectedDate);
|
||||||
|
setSelectedHours(formatInputTime(defaultSelectedDate.getHours()));
|
||||||
|
setSelectedMinutes(formatInputTime(defaultSelectedDate.getMinutes()));
|
||||||
|
}
|
||||||
|
}, [defaultSelectedDate, isFutureMode, selectedDate]);
|
||||||
|
|
||||||
const shouldDisableNextMonth = (isPastMode && currentYear >= now.getFullYear() && currentMonth >= now.getMonth())
|
const shouldDisableNextMonth = (isPastMode && currentYear >= now.getFullYear() && currentMonth >= now.getMonth())
|
||||||
|| (maxDate && currentYear >= maxDate.getFullYear() && currentMonth >= maxDate.getMonth());
|
|| (maxDate && currentYear >= maxDate.getFullYear() && currentMonth >= maxDate.getMonth());
|
||||||
const shouldDisablePrevMonth = isFutureMode && currentYear <= now.getFullYear() && currentMonth <= now.getMonth();
|
const shouldDisablePrevMonth = isFutureMode && currentYear <= now.getFullYear() && currentMonth <= now.getMonth();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user