aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdebdate15
1 files changed, 12 insertions, 3 deletions
diff --git a/debdate b/debdate
index 5f10c3c..c05d297 100755
--- a/debdate
+++ b/debdate
@@ -82,12 +82,12 @@ class DebDate:
day=day,
)
)
- delta = relativedelta.relativedelta(day, epoch)
- data['yodr'] = delta.years + 1
- if delta.years == 0:
+ if day.year == epoch.year:
data['dody'] = (day - epoch).days
+ data['yodr'] = 1
else:
data['dody'] = day.timetuple().tm_yday
+ data['yodr'] = day.year - epoch.year + 1
return data
@@ -122,6 +122,15 @@ class TestDebDate(unittest.TestCase):
self.assertEqual(data['yodr'], 2)
self.assertEqual(data['release'], r[1])
+ def testJanuarySecondYearRelease(self):
+ for debdate in self.debdates:
+ r = debdate.releases[-6]
+ d = datetime.date(r[0].year + 1, 1, 1)
+ data = debdate.get_release(d)
+ self.assertEqual(data['dody'], 1)
+ self.assertEqual(data['yodr'], 2)
+ self.assertEqual(data['release'], r[1])
+
def testPastLatestRelease(self):
for debdate in self.debdates:
r = debdate.releases[0]