diff --git a/tailbone/views/shifts/schedule.py b/tailbone/views/shifts/schedule.py index 2509053f..4dcbfc01 100644 --- a/tailbone/views/shifts/schedule.py +++ b/tailbone/views/shifts/schedule.py @@ -169,11 +169,20 @@ class ScheduleView(TimeSheetView): .filter(model.ScheduledShift.start_time >= make_utc(start_time))\ .filter(model.ScheduledShift.end_time < make_utc(end_time)) for shift in shifts: + + # must calculate new times using date as base, b/c of daylight savings + start_time = localtime(self.rattail_config, shift.start_time, from_utc=True) + start_time = datetime.datetime.combine(start_time.date() + offset, start_time.time()) + start_time = localtime(self.rattail_config, start_time) + end_time = localtime(self.rattail_config, shift.end_time, from_utc=True) + end_time = datetime.datetime.combine(end_time.date() + offset, end_time.time()) + end_time = localtime(self.rattail_config, end_time) + Session.add(model.ScheduledShift( employee_uuid=shift.employee_uuid, store_uuid=shift.store_uuid, - start_time=shift.start_time + offset, - end_time=shift.end_time + offset, + start_time=make_utc(start_time), + end_time=make_utc(end_time), )) copied += 1