diff --git a/calendar/classes/local/api.php b/calendar/classes/local/api.php index e59f34e95ec..a29a429b099 100644 --- a/calendar/classes/local/api.php +++ b/calendar/classes/local/api.php @@ -325,6 +325,12 @@ class api { 'core_calendar_event_timestart_updated', [$legacyevent, $moduleinstance] ); + + // Rebuild the course cache to make sure the updated dates are reflected. + $courseid = $event->get_course()->get('id'); + $cmid = $event->get_course_module()->get('id'); + \course_modinfo::purge_course_module_cache($courseid, $cmid); + rebuild_course_cache($courseid, true, true); } return $mapper->from_legacy_event_to_event($legacyevent);