diff --git a/engine/apps/schedules/models/custom_on_call_shift.py b/engine/apps/schedules/models/custom_on_call_shift.py index 96cc2db2bc..27d26ceb8b 100644 --- a/engine/apps/schedules/models/custom_on_call_shift.py +++ b/engine/apps/schedules/models/custom_on_call_shift.py @@ -373,6 +373,8 @@ def convert_to_ical(self, time_zone="UTC", allow_empty_users=False): expected_start_day = min(CustomOnCallShift.ICAL_WEEKDAY_REVERSE_MAP[d] for d in self.by_day) delta = (expected_start_day - start.weekday()) % 7 start = start + timezone.timedelta(days=delta) + if self.until is not None: + self.until = self.until + timezone.timedelta(days=delta) if self.frequency == CustomOnCallShift.FREQUENCY_DAILY and self.by_day: result = self._daily_by_day_to_ical(time_zone, start, users_queue)