fix leap year fix
This commit is contained in:
parent
338fd54e6b
commit
98655e61c5
3
tools.py
3
tools.py
|
@ -232,7 +232,8 @@ 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
|
||||||
units['day'] -= calendar.leapdays(time_2.year, time_1.year)
|
if units.get('year'):
|
||||||
|
units['day'] -= calendar.leapdays(time_2.year, time_1.year)
|
||||||
|
|
||||||
if not any(units.values()):
|
if not any(units.values()):
|
||||||
if diff.seconds // 3600:
|
if diff.seconds // 3600:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user