fix leap year fix
This commit is contained in:
parent
338fd54e6b
commit
98655e61c5
1
tools.py
1
tools.py
|
@ -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()):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user