aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-08-01 02:53:34 -0700
committerFuwn <[email protected]>2023-08-01 02:53:34 -0700
commit456723cdfbfa06d1e8ac804e8a42ac8020a1c12e (patch)
tree47e6ee32ca1aa391e3a72b1355ed71dfe63d0a0c /src
parentfeat(anime): show time until next (diff)
downloadold.due.moe-456723cdfbfa06d1e8ac804e8a42ac8020a1c12e.tar.xz
old.due.moe-456723cdfbfa06d1e8ac804e8a42ac8020a1c12e.zip
fix(anime): fix plural countdown
Diffstat (limited to 'src')
-rw-r--r--src/due/html/anime.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/due/html/anime.py b/src/due/html/anime.py
index 888e4f0..1125954 100644
--- a/src/due/html/anime.py
+++ b/src/due/html/anime.py
@@ -41,14 +41,22 @@ def anime_to_html(releasing_outdated_anime):
hours = airing_at / 3600
if hours >= 24:
- available = (
- str(available)
- + f'] <span style="opacity: 50%">{available + 1} in ~{int(round(hours // 24, 0))} days'
- )
+ weeks = (hours // 24) // 7
+
+ if weeks >= 1:
+ available = (
+ str(available)
+ + f'] <span style="opacity: 50%">{available + 1} in {int(round(weeks, 0))} week{"" if weeks == 1 else "s"}'
+ )
+ else:
+ available = (
+ str(available)
+ + f'] <span style="opacity: 50%">{available + 1} in {int(round(hours // 24, 0))} day{"" if hours // 24 == 1 else "s"}'
+ )
else:
available = (
str(available)
- + f'] <span style="opacity: 50%">{available + 1} in ~{int(round(hours, 0))} hours'
+ + f'] <span style="opacity: 50%">{available + 1} in {int(round(hours, 0))} hour{"" if hours // 24 == 1 else "s"}'
)
available = str(available) + "</span>"