Title: `now` ignores `TZ` environment variable · Issue #905 · python-pendulum/pendulum · GitHub
Open Graph Title: `now` ignores `TZ` environment variable · Issue #905 · python-pendulum/pendulum
X Title: `now` ignores `TZ` environment variable · Issue #905 · python-pendulum/pendulum
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 use...
Open Graph 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...
X 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...
Opengraph URL: https://github.com/python-pendulum/pendulum/issues/905
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`now` ignores `TZ` environment variable","articleBody":"- [x] I am on the [latest](https://github.com/sdispater/pendulum/releases/latest) Pendulum version.\n- [x] I have searched the [issues](https://github.com/sdispater/pendulum/issues) of this repo and believe that this is not a duplicate.\n\n- **OS version and name**: MacOS 15.5\n- **Pendulum version**: 3.1.0\n\n## Issue\n\nOn 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.\n\nExample of the bug in action:\n\n```shellsession\n$ TZ=\"Asia/Tokyo\" python -c \"import pendulum; print(pendulum.now())\"\n2025-07-26 14:05:16.412699+02:00\n```\n\nIt seems to take the local offset (+2, western europe) instead of using `TZ` (+9). The standard library does this correctly:\n\n```shellsession\n$ TZ=\"Asia/Tokyo\" python -c \"from datetime import datetime; print(datetime.now().astimezone())\"\n2025-07-26 21:04:53.050771+09:00\n```\n\nThis 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.\n\nedit: formatting","author":{"url":"https://github.com/ariebovenberg","@type":"Person","name":"ariebovenberg"},"datePublished":"2025-07-26T12:08:52Z","url":"https://github.com/python-pendulum/pendulum/issues/905"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c33d3f37-238a-3e3a-b5d2-1022d06f6af2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 917A:20A8C6:11C0FB:188BC2:6B046482 |
| html-safe-nonce | ea4a34e7af3ad513e7696554da9d829c988523c5ab487a98477a51ddbb4f65c7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MTdBOjIwQThDNjoxMUMwRkI6MTg4QkMyOjZCMDQ2NDgyIiwidmlzaXRvcl9pZCI6IjUzODM0MjAxNzkzNTMxOTk3NDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9140181842785de18724c81bbde8be2bbc4ca76c82cc4ee18e7f75bfe819ab4c |
| hovercard-subject-tag | issue:3265505621 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-pendulum/pendulum/905/issue_layout |
| twitter:image | https://opengraph.githubassets.com/055a0d64993436ef70cc13e60f68d6b29ff920be30677dea27b052a6697f46de/python-pendulum/pendulum/issues/905 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/055a0d64993436ef70cc13e60f68d6b29ff920be30677dea27b052a6697f46de/python-pendulum/pendulum/issues/905 |
| og:image:alt | 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... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ariebovenberg |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2d58451b4bcb73c33c67bfb6b28fb75fe6d5e279daf9b560fa4fd832f3d8c9a6 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-pendulum/pendulum git https://github.com/python-pendulum/pendulum.git |
| octolytics-dimension-user_id | 191041900 |
| octolytics-dimension-user_login | python-pendulum |
| octolytics-dimension-repository_id | 62095504 |
| octolytics-dimension-repository_nwo | python-pendulum/pendulum |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 62095504 |
| octolytics-dimension-repository_network_root_nwo | python-pendulum/pendulum |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 03e114520787ad27289207f153520ef97461127c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width