diff --git a/agenda/data.py b/agenda/data.py index 32c56f7..849b205 100644 --- a/agenda/data.py +++ b/agenda/data.py @@ -265,14 +265,20 @@ async def get_data(now: datetime) -> typing.Mapping[str, str | object]: events += domains.renewal_dates(my_data) for launch in rockets: - if not launch["t0_time"]: + dt = None + + if launch["net_precision"] == "Day": + dt = datetime.strptime(launch["net"], "%Y-%m-%dT00:00:00Z").date() + elif launch["t0_time"]: + dt = pytz.utc.localize( + datetime.strptime(launch["net"], "%Y-%m-%dT%H:%M:%SZ") + ) + + if not dt: continue - dt = pytz.utc.localize(datetime.strptime(launch["net"], "%Y-%m-%dT%H:%M:%SZ")) - e = Event( - name="rocket", - date=dt, - title=f'🚀{launch["rocket"]}: {launch["mission"]["name"]}', - ) + + rocket_name = f'🚀{launch["rocket"]}: {launch["mission"]["name"]}' + e = Event(name="rocket", date=dt, title=rocket_name) events.append(e) events.sort(key=operator.attrgetter("as_datetime"))