mirror of
https://github.com/urosran/cally.git
synced 2025-11-26 00:24:53 +00:00
Functions update
This commit is contained in:
@ -17,8 +17,21 @@ export const useCalendarControls = (events: any[]) => {
|
||||
|
||||
const handlePressEvent = useCallback((event: any) => {
|
||||
const foundEvent = events?.find(x => x.id === event.id);
|
||||
setEditVisible(true);
|
||||
setEventForEdit(foundEvent!);
|
||||
|
||||
if (foundEvent) {
|
||||
const processedEvent = {
|
||||
...foundEvent,
|
||||
startDate: foundEvent.startDate?.seconds ?
|
||||
new Date(foundEvent.startDate.seconds * 1000) :
|
||||
new Date(foundEvent.start),
|
||||
endDate: foundEvent.endDate?.seconds ?
|
||||
new Date(foundEvent.endDate.seconds * 1000) :
|
||||
new Date(foundEvent.end)
|
||||
};
|
||||
|
||||
setEditVisible(true);
|
||||
setEventForEdit(processedEvent);
|
||||
}
|
||||
}, [events, setEditVisible, setEventForEdit]);
|
||||
|
||||
const handlePressCell = useCallback((date: DateOrDateTime) => {
|
||||
|
||||
Reference in New Issue
Block a user