mirror of
https://github.com/kennethreitz/maya.git
synced 2026-06-05 23:00:18 +00:00
Fix subtracting MayaDT instances. Fixes #151
This commit is contained in:
+1
-1
@@ -152,7 +152,7 @@ class MayaDT(object):
|
||||
|
||||
def subtract_date(self, **kwargs):
|
||||
"""Returns a timedelta object with the duration between the dates"""
|
||||
return timedelta(self.epoch - kwargs['dt'].epoch)
|
||||
return timedelta(seconds=self.epoch - kwargs['dt'].epoch)
|
||||
|
||||
def snap(self, instruction):
|
||||
"""
|
||||
|
||||
+2
-2
@@ -320,8 +320,8 @@ def test_dunder_sub():
|
||||
def test_mayaDT_sub():
|
||||
now = maya.now()
|
||||
then = now.add(days=1)
|
||||
assert then - now == timedelta(24 * 60 * 60)
|
||||
assert now - then == timedelta(-24 * 60 * 60)
|
||||
assert then - now == timedelta(seconds=24 * 60 * 60)
|
||||
assert now - then == timedelta(seconds=-24 * 60 * 60)
|
||||
|
||||
|
||||
def test_core_local_timezone(monkeypatch):
|
||||
|
||||
Reference in New Issue
Block a user