Merge pull request #1568 from cikezhu/main

fix time_difference()
This commit is contained in:
jxxghp 2024-02-29 21:49:20 +08:00 committed by GitHub
commit 1db452e268
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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