Python backend: Date difference should always return duration in days (#396)

This commit is contained in:
Louis Gesbert 2023-02-15 16:17:19 +01:00 committed by GitHub
commit e5da498d15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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: