From fe664be570b8cf210d9e95ba613351cf79198c96 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Thu, 9 Nov 2023 10:58:49 +0100 Subject: [PATCH] Add formatting for dates with precision 10 and 11 --- depicts/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/depicts/utils.py b/depicts/utils.py index 81dd8c1..569f5f1 100644 --- a/depicts/utils.py +++ b/depicts/utils.py @@ -123,6 +123,10 @@ def format_time(time_value: str, precision: int) -> str: return time_value year = t.year + if precision == 11: + return t.strftime("%-d %B %Y") + if precision == 10: + return datetime.strptime(time_value[1:9] + "01", "%Y-%m-%d").strftime("%B %Y") if precision == 9: return str(year) if precision == 8: