From 74c9132fdc817ce2b3f3e580a553ce1d6dcb6369 Mon Sep 17 00:00:00 2001 From: parpa Date: Fri, 16 May 2025 22:28:22 +0900 Subject: [PATCH] Update utils.py Fix timedeltaformat when total_seconds is less than 1s. Signed-off-by: parpa --- openleadr/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openleadr/utils.py b/openleadr/utils.py index 2cf4c31..9f57889 100755 --- a/openleadr/utils.py +++ b/openleadr/utils.py @@ -331,6 +331,8 @@ def timedeltaformat(value): """ if not isinstance(value, timedelta): return value + if value.total_seconds() < 1: + return "PT0S" days = value.days hours, seconds = divmod(value.seconds, 3600) minutes, seconds = divmod(seconds, 60)