From 4a0e151b2c000bb923a12e0d8d6cce977c1f5f63 Mon Sep 17 00:00:00 2001 From: Piotr Janiszewski Date: Sun, 18 Dec 2022 21:31:28 +0100 Subject: [PATCH] Do not remove timezone when incrementing month in _get_next_dt --- arq/cron.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arq/cron.py b/arq/cron.py index 2eca6c75..94775986 100644 --- a/arq/cron.py +++ b/arq/cron.py @@ -66,9 +66,9 @@ def _get_next_dt(dt_: datetime, options: Options) -> Optional[datetime]: # noqa micro = max(dt_.microsecond - options.microsecond, 0) if field == 'month': if dt_.month == 12: - return datetime(dt_.year + 1, 1, 1) + return datetime(dt_.year + 1, 1, 1, tzinfo=dt_.tzinfo) else: - return datetime(dt_.year, dt_.month + 1, 1) + return datetime(dt_.year, dt_.month + 1, 1, tzinfo=dt_.tzinfo) elif field in ('day', 'weekday'): return ( dt_