Add formatting for dates with precision 10 and 11

This commit is contained in:
Edward Betts 2023-11-09 10:58:49 +01:00
parent cc97f41f2b
commit fe664be570

View file

@ -123,6 +123,10 @@ def format_time(time_value: str, precision: int) -> str:
return time_value return time_value
year = t.year 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: if precision == 9:
return str(year) return str(year)
if precision == 8: if precision == 8: