fix leap year fix

This commit is contained in:
iou1name 2022-02-16 17:29:12 -05:00
parent 338fd54e6b
commit 98655e61c5

View File

@ -232,6 +232,7 @@ def relative_time(time_1, time_2):
units['year'] = diff.days // 365 units['year'] = diff.days // 365
if diff.days >= 0: if diff.days >= 0:
units['day'] = diff.days - units.get('year', 0)*365 units['day'] = diff.days - units.get('year', 0)*365
if units.get('year'):
units['day'] -= calendar.leapdays(time_2.year, time_1.year) units['day'] -= calendar.leapdays(time_2.year, time_1.year)
if not any(units.values()): if not any(units.values()):