From 81ca11650d95e377075f5f5e3628bcb3e49a5e80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=AE=E5=8F=AE=E5=BD=93?= <604054726@qq.com> Date: Thu, 29 Feb 2024 21:39:32 +0800 Subject: [PATCH] fix time_difference() --- app/utils/timer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/utils/timer.py b/app/utils/timer.py index 7e4f76e3..45a08c2d 100644 --- a/app/utils/timer.py +++ b/app/utils/timer.py @@ -56,7 +56,7 @@ class TimerUtils: days = time_difference.days hours, remainder = divmod(time_difference.seconds, 3600) - minutes, _ = divmod(remainder, 60) + minutes, second = divmod(remainder, 60) time_difference_string = "" if days > 0: @@ -65,6 +65,8 @@ class TimerUtils: time_difference_string += f"{hours}小时" if minutes > 0: time_difference_string += f"{minutes}分钟" + if not time_difference_string and second: + time_difference_string = f"{second}秒" return time_difference_string