diff --git a/agenda/thespacedevs.py b/agenda/thespacedevs.py index 01f3933..eadce46 100644 --- a/agenda/thespacedevs.py +++ b/agenda/thespacedevs.py @@ -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 = {