From ae4a10ab4e581deedc510778005292a6fdcc3cad Mon Sep 17 00:00:00 2001 From: Matthew Kenigsberg Date: Fri, 23 Jul 2021 17:35:07 -0400 Subject: [PATCH] Fix now(tz) now(tz) should return the same time utcnow returns adjusted by whatever offset is contained by tz. Currently, the offset to freeze_time is also added, which is removed by this change Closes https://github.com/spulec/freezegun/issues/405 --- freezegun/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freezegun/api.py b/freezegun/api.py index 81d4da17..bfa44378 100644 --- a/freezegun/api.py +++ b/freezegun/api.py @@ -385,7 +385,7 @@ def timestamp(self): def now(cls, tz=None): now = cls._time_to_freeze() or real_datetime.now() if tz: - result = tz.fromutc(now.replace(tzinfo=tz)) + cls._tz_offset() + result = tz.fromutc(now.replace(tzinfo=tz)) else: result = now + cls._tz_offset() return datetime_to_fakedatetime(result)