From 9c840626a8602667770738707f03aa84db8b2b0f Mon Sep 17 00:00:00 2001 From: Paul Hebble Date: Sun, 12 Nov 2023 23:35:10 -0600 Subject: [PATCH] Fix timezone problem in ticket closer --- netkan/netkan/ticket_closer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netkan/netkan/ticket_closer.py b/netkan/netkan/ticket_closer.py index a140b620..0b5ec841 100644 --- a/netkan/netkan/ticket_closer.py +++ b/netkan/netkan/ticket_closer.py @@ -1,5 +1,5 @@ import logging -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone from importlib.resources import read_text from collections import defaultdict from string import Template @@ -18,7 +18,7 @@ def __init__(self, token: str, user_name: str) -> None: self._user_name = user_name def close_tickets(self, days_limit: int = 7) -> None: - date_cutoff = datetime.now() - timedelta(days=days_limit) + date_cutoff = datetime.now(timezone.utc) - timedelta(days=days_limit) for repo_name in self.REPO_NAMES: repo = self._gh.get_repo(f'{self._user_name}/{repo_name}')