diff --git a/gramps/gen/lib/date.py b/gramps/gen/lib/date.py index 4b5cccee3..ffca6263e 100644 --- a/gramps/gen/lib/date.py +++ b/gramps/gen/lib/date.py @@ -1332,6 +1332,8 @@ class Date(object): self._calc_sort_value() if day != 0 or dv[Date._POS_DAY] > 28: self.set_yr_mon_day(*self.offset(day)) + if self.is_compound(): + self.set2_yr_mon_day_offset(year, month, day) def set2_yr_mon_day_offset(self, year=0, month=0, day=0): """ @@ -1378,8 +1380,6 @@ class Date(object): new_date = self retval = Date(new_date) retval.set_yr_mon_day_offset(year, month, day) - if self.is_compound(): - retval.set2_yr_mon_day_offset(year, month, day) if orig_cal == 0: return retval else: diff --git a/gramps/gen/lib/test/date_test.py b/gramps/gen/lib/test/date_test.py index 198e1a865..5681d3ad3 100644 --- a/gramps/gen/lib/test/date_test.py +++ b/gramps/gen/lib/test/date_test.py @@ -450,6 +450,12 @@ class Test_set2(BaseDateTest): self.assertEqual(start, (2000, 1, 1)) self.assertEqual(stop, (2013, 2, 2)) + def test_set_ymd_offset_updates_both_ends(self): + self.date.set_yr_mon_day_offset(+2, +2, +2) + start,stop = self.date.get_start_stop_range() + self.assertEqual(start, (2002, 3, 3)) + self.assertEqual(stop, (2012, 3, 3)) + def test_set2_ymd_offset_updates_stop_date(self): self.date.set2_yr_mon_day_offset(+7, +5, +5) start,stop = self.date.get_start_stop_range()