fix: resolve infinite loop and week calculation issues in EventModal
- Fix infinite loop in EventModal useEffect by using useRef for userPersonnalCalendars - Fix weekStart calculation in putEventAsync to use Monday as first day (consistent with FullCalendar firstDay=1) - Add computeWeekRange utility function for consistent week calculations - Improve state reset logic when closing EventModal popup - Ensure repeat checkbox state is properly reset to prevent stale repetition data
This commit is contained in:
@@ -52,3 +52,10 @@ export const computeStartOfTheWeek = (date: Date): Date => {
|
||||
startOfWeek.setHours(0, 0, 0, 0);
|
||||
return startOfWeek;
|
||||
};
|
||||
|
||||
export const computeWeekRange = (date: Date): { start: Date; end: Date } => {
|
||||
const weekStart = computeStartOfTheWeek(date);
|
||||
const weekEnd = new Date(weekStart);
|
||||
weekEnd.setDate(weekStart.getDate() + 7);
|
||||
return { start: weekStart, end: weekEnd };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user