more date fixes

This commit is contained in:
Dobromir Popov
2024-05-05 22:39:22 +02:00
parent 1394c5ba4d
commit 27a65b7dc0
4 changed files with 76 additions and 23 deletions

View File

@ -230,10 +230,13 @@ const AvCalendar = ({ publisherId, events, selectedDate, cartEvents }) => {
end = common.setTimeHHmm(startdate, "23:59");
}
setDate(start);
let existingEvents = filterEvents(evts, publisherId, startdate);
console.log("handleSelect: " + existingEvents);
setCartEvent(getCartEvent(date));
// Update date state and calculate events based on the new startdate
setDate(startdate);
const existingEvents = filterEvents(evts, publisherId, startdate);
console.log("handleSelect: ", existingEvents);
// Use the updated startdate for getCartEvent and ensure it reflects in the state properly
setCartEvent(getCartEvent(startdate));
setSelectedEvents(existingEvents);
setIsModalOpen(true);
};