From f69d1339c96d372767b0b3c5b05bf1f228aaddac Mon Sep 17 00:00:00 2001 From: Fuwn Date: Mon, 7 Jul 2025 02:50:13 -0700 Subject: fix(schedule): Replace old date selection logic --- src/oguri/schedule.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/oguri/schedule.py b/src/oguri/schedule.py index 15b7fe1..1d48a54 100644 --- a/src/oguri/schedule.py +++ b/src/oguri/schedule.py @@ -28,15 +28,10 @@ async def show_schedule( ): client = Client(url="https://graphql.anilist.co") now = datetime.now() - target_year = year if year is not None else now.year - target_month = month if month is not None else now.month - if days_offset != 0: - start_of_day = now.replace( - hour=0, minute=0, second=0, microsecond=0) + timedelta(days=days_offset) - end_of_day = start_of_day.replace( - hour=23, minute=59, second=59, microsecond=999999) - else: + if year is not None or month is not None: + target_year = year if year is not None else now.year + target_month = month if month is not None else now.month start_of_day = datetime(target_year, target_month, 1).replace( hour=0, minute=0, second=0, microsecond=0) @@ -45,6 +40,11 @@ async def show_schedule( else: end_of_day = datetime(target_year, target_month + 1, 1) - timedelta(microseconds=1) + else: + start_of_day = now.replace( + hour=0, minute=0, second=0, microsecond=0) + timedelta(days=days_offset) + end_of_day = start_of_day.replace( + hour=23, minute=59, second=59, microsecond=999999) airing_schedules_query = Query.page().fields( PageFields.airing_schedules( -- cgit v1.2.3