Skip to content

Commit 2fda6f8

Browse files
committed
Fix TZ env variable not being respected on MacOS
1 parent 02f87ce commit 2fda6f8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/pendulum/tz/local_timezone.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ def _get_windows_timezone() -> Timezone:
150150

151151

152152
def _get_darwin_timezone() -> Timezone:
153+
if tzenv := os.environ.get("TZ"):
154+
with contextlib.suppress(ValueError):
155+
return _tz_from_env(tzenv)
153156
# link will be something like /usr/share/zoneinfo/America/Los_Angeles.
154157
link = os.readlink("/etc/localtime")
155158
tzname = link[link.rfind("zoneinfo/") + 9 :]

0 commit comments

Comments
 (0)