diff --git a/src/undate/undate.py b/src/undate/undate.py index 96dd346..e816adb 100644 --- a/src/undate/undate.py +++ b/src/undate/undate.py @@ -331,8 +331,8 @@ def duration(self) -> datetime.timedelta: duration = end - self.earliest.earliest # add the additional day *after* checking for a negative - else: - duration += ONE_DAY + # or after recalculating with adjusted year + duration += ONE_DAY return duration diff --git a/tests/test_undate.py b/tests/test_undate.py index 7293553..d02c3d2 100644 --- a/tests/test_undate.py +++ b/tests/test_undate.py @@ -264,11 +264,12 @@ def test_duration(self): month_noyear_duration = UndateInterval( Undate(None, 12, 1), Undate(None, 1, 1) ).duration() - assert month_noyear_duration.days == 31 + assert month_noyear_duration.days == 32 + # this seems wrong, but we currently count both start and dates # real case from Shakespeare and Company Project data; # second date is a year minus one day in the future month_noyear_duration = UndateInterval( Undate(None, 6, 7), Undate(None, 6, 6) ).duration() - assert month_noyear_duration.days == 364 + assert month_noyear_duration.days == 365