-
-
Notifications
You must be signed in to change notification settings - Fork 403
Open
Milestone
Description
-
I am on the latest Pendulum version.
-
I have searched the issues of this repo and believe that this is not a duplicate.
-
OS version and name: MacOS 15.5
-
Pendulum version: 3.1.0
Issue
On posix systems, the TZ
environment variable can be used to set the system timezone. It takes precedence over other configuration. Pendulum doesn't appear to account for this.
Example of the bug in action:
$ TZ="Asia/Tokyo" python -c "import pendulum; print(pendulum.now())"
2025-07-26 14:05:16.412699+02:00
It seems to take the local offset (+2, western europe) instead of using TZ
(+9). The standard library does this correctly:
$ TZ="Asia/Tokyo" python -c "from datetime import datetime; print(datetime.now().astimezone())"
2025-07-26 21:04:53.050771+09:00
This issue is similar (but not the same) as #497. It appears pendulum 3.0 fixed this inconsistency, but as the cost of ignoring TZ
altogether.
edit: formatting
Metadata
Metadata
Assignees
Labels
No labels