fix set_yr_mon_day_offset for compound dates
now calls set2_yr_mon_day_offset svn: r23057
This commit is contained in:
parent
d4b9448cbc
commit
39927c45bd
@ -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:
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user