Handle spaces launches with 'week' precision

This commit is contained in:
Edward Betts 2023-10-10 06:55:23 +01:00
parent 2483fe8d60
commit 22291d4f47

View file

@ -37,8 +37,13 @@ def format_time(time_str: str, net_precision: str) -> tuple[str, str | None]:
include_time = False
# Format the date based on precision
time_format: str | None = None
field2 = None
if net_precision == "Month":
time_format = "%b %Y"
if net_precision == "Week":
time_format = "%d %b %Y"
field2 = "(Week of)"
if net_precision == "Day":
time_format = "%d %b %Y"
if net_precision == "Hour":
@ -53,6 +58,9 @@ def format_time(time_str: str, net_precision: str) -> tuple[str, str | None]:
elif net_precision.startswith("Quarter "):
time_format = f"Q{net_precision[-1]} %Y"
if not time_format:
return (repr(time_str), repr(net_precision))
assert time_format
formatted = dt.strftime(time_format)
@ -60,7 +68,7 @@ def format_time(time_str: str, net_precision: str) -> tuple[str, str | None]:
if include_time:
return (formatted, dt.strftime("%H:%M"))
else:
return (formatted, None)
return (formatted, field2)
launch_providers = {