From 9a42fe01915ee9e8a5bfbb1bef197b92ac5c8f44 Mon Sep 17 00:00:00 2001 From: Serhii Abarovskyi Date: Wed, 7 Dec 2022 13:37:13 +0200 Subject: [PATCH] Fix PytzUsageWarning --- dateparser/freshness_date_parser.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/dateparser/freshness_date_parser.py b/dateparser/freshness_date_parser.py index 36ce40e50..2d1ff1aa2 100644 --- a/dateparser/freshness_date_parser.py +++ b/dateparser/freshness_date_parser.py @@ -72,10 +72,7 @@ def apply_time(dateobj, timeobj): now = now.replace(tzinfo=ptz) if not now.tzinfo: - if hasattr(self.get_local_tz(), 'localize'): - now = self.get_local_tz().localize(now) - else: - now = now.replace(tzinfo=self.get_local_tz()) + now = now.replace(tzinfo=self.get_local_tz()) elif ptz: localized_now = datetime.now(ptz)