decompose_interval: 0 years should be 0 seconds

This commit is contained in:
codl 2017-08-01 21:15:58 +02:00
parent 0f80fc74a0
commit 78cb985a4b
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
1 changed files with 4 additions and 0 deletions

View File

@ -19,6 +19,10 @@ def decompose_interval(attrname):
@property
def scale(self):
if getattr(self, attrname) == timedelta(0):
return timedelta(seconds=1)
for m in scales:
if getattr(self, attrname) % m == timedelta(0):
return m