aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-07-07 02:50:13 -0700
committerFuwn <[email protected]>2025-07-07 02:50:13 -0700
commitf69d1339c96d372767b0b3c5b05bf1f228aaddac (patch)
tree8f19ee557ccd636eb0cbb91d7bd1ac770db33c18
parentfeat(cli): Shorten help strings (diff)
downloadoguri-f69d1339c96d372767b0b3c5b05bf1f228aaddac.tar.xz
oguri-f69d1339c96d372767b0b3c5b05bf1f228aaddac.zip
fix(schedule): Replace old date selection logic
-rw-r--r--src/oguri/schedule.py16
1 files 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(