From 4c9bff1b74e69c9119c2a5a56c2a57e93f0d9e82 Mon Sep 17 00:00:00 2001 From: Rohan Padhye Date: Tue, 14 Feb 2023 13:48:19 -0500 Subject: [PATCH] Python backend: Date difference should always return duration in days --- runtimes/python/catala/src/catala/runtime.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtimes/python/catala/src/catala/runtime.py b/runtimes/python/catala/src/catala/runtime.py index 6bcfa705..484d71a5 100644 --- a/runtimes/python/catala/src/catala/runtime.py +++ b/runtimes/python/catala/src/catala/runtime.py @@ -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: