From 128d7ac282db90999da56bee833cf426a059d453 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Sun, 7 Jul 2024 12:01:56 +0100 Subject: [PATCH] Add support for plural/singular time periods --- agenda/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/agenda/utils.py b/agenda/utils.py index eb66a74..e8f124d 100644 --- a/agenda/utils.py +++ b/agenda/utils.py @@ -49,10 +49,10 @@ def human_readable_delta(future_date: date) -> str | None: # Formatting the output parts = [] if months > 0: - parts.append(f"{months} months") + parts.append(f"{months} month{'s' if months > 1 else ''}") if weeks > 0: - parts.append(f"{weeks} weeks") + parts.append(f"{weeks} week{'s' if weeks > 1 else ''}") if days > 0: - parts.append(f"{days} days") + parts.append(f"{days} day{'s' if days > 1 else ''}") return " ".join(parts) if parts else None