From 030e0af610c1665dd8984c3e98dee67a905cecae Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Thu, 2 Nov 2023 15:18:57 +0000 Subject: [PATCH] Add support for decades to format_wikibase_time --- matcher/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/matcher/utils.py b/matcher/utils.py index 36bbe99..144b7cb 100644 --- a/matcher/utils.py +++ b/matcher/utils.py @@ -198,6 +198,8 @@ def format_wikibase_time(v: WikibaseTime) -> str | None: return date.fromisoformat(t[1:8] + "-01").strftime("%B %Y") case 9: # year return t[1:5] + case 8: # decade + return f"{t[1:4]}0s" case 7: # century century = ((int(t[:5]) - 1) // 100) + 1 ordinal_num: str = num2words(abs(century), to="ordinal_num")