Python backend: Date difference should always return duration in days

This commit is contained in:
Rohan Padhye 2023-02-14 13:48:19 -05:00
parent d92ae2ccfd
commit 4c9bff1b74

View File

@ -200,7 +200,7 @@ class Date:
def __sub__(self, other: object) -> object:
if isinstance(other, Date):
return Duration(dateutil.relativedelta.relativedelta(self.value, other.value))
return Duration(dateutil.relativedelta.relativedelta(days=(self.value - other.value).days))
elif isinstance(other, Duration):
return Date(self.value - other.value)
else: