-
Notifications
You must be signed in to change notification settings - Fork 197
Closed
Labels
Description
print(maya.when('tomorrow') - maya.when('today'))Prints out:
86400 days, 0:00:00
To fix this, in the MayaDT.subtract_date method, specify that you're setting the seconds of the timedelta object you create:
def subtract_date(self, **kwargs):
"""Returns a timedelta object with the duration between the dates"""
return timedelta(seconds=self.epoch - kwargs['dt'].epoch)This will make at least one of your tests fail (same fix should be applied to it, pass the calculated seconds in as seconds:
@pytest.mark.usefixtures("frozen_now")
def test_mayaDT_sub():
now = maya.now()
then = now.add(days=1)
assert then - now == timedelta(seconds=24 * 60 * 60)
assert now - then == timedelta(seconds=-24 * 60 * 60)