Handle spaces launches with 'week' precision
This commit is contained in:
parent
2483fe8d60
commit
22291d4f47
|
@ -37,8 +37,13 @@ def format_time(time_str: str, net_precision: str) -> tuple[str, str | None]:
|
||||||
|
|
||||||
include_time = False
|
include_time = False
|
||||||
# Format the date based on precision
|
# Format the date based on precision
|
||||||
|
time_format: str | None = None
|
||||||
|
field2 = None
|
||||||
if net_precision == "Month":
|
if net_precision == "Month":
|
||||||
time_format = "%b %Y"
|
time_format = "%b %Y"
|
||||||
|
if net_precision == "Week":
|
||||||
|
time_format = "%d %b %Y"
|
||||||
|
field2 = "(Week of)"
|
||||||
if net_precision == "Day":
|
if net_precision == "Day":
|
||||||
time_format = "%d %b %Y"
|
time_format = "%d %b %Y"
|
||||||
if net_precision == "Hour":
|
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 "):
|
elif net_precision.startswith("Quarter "):
|
||||||
time_format = f"Q{net_precision[-1]} %Y"
|
time_format = f"Q{net_precision[-1]} %Y"
|
||||||
|
|
||||||
|
if not time_format:
|
||||||
|
return (repr(time_str), repr(net_precision))
|
||||||
|
|
||||||
assert time_format
|
assert time_format
|
||||||
|
|
||||||
formatted = dt.strftime(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:
|
if include_time:
|
||||||
return (formatted, dt.strftime("%H:%M"))
|
return (formatted, dt.strftime("%H:%M"))
|
||||||
else:
|
else:
|
||||||
return (formatted, None)
|
return (formatted, field2)
|
||||||
|
|
||||||
|
|
||||||
launch_providers = {
|
launch_providers = {
|
||||||
|
|
Loading…
Reference in a new issue