Title: naive DateTime.diff fails when the input is a naive datetime object, as pendulum.instance converts it to a pendulum.DateTime with UTC tz · Issue #880 · python-pendulum/pendulum · GitHub
Open Graph Title: naive DateTime.diff fails when the input is a naive datetime object, as pendulum.instance converts it to a pendulum.DateTime with UTC tz · Issue #880 · python-pendulum/pendulum
X Title: naive DateTime.diff fails when the input is a naive datetime object, as pendulum.instance converts it to a pendulum.DateTime with UTC tz · Issue #880 · 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: Ubuntu 22.04.3 LTS (running in WSL2) Pendulum version: 3.0.0 Issue When a naive pendulum.DateTime...
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: Ubuntu 22.04.3 LTS (running in WSL2) Pendulum version: 3....
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: Ubuntu 22.04.3 LTS (running in WSL2) Pendulum version: 3....
Opengraph URL: https://github.com/python-pendulum/pendulum/issues/880
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"naive DateTime.diff fails when the input is a naive datetime object, as pendulum.instance converts it to a pendulum.DateTime with UTC tz","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\n- **OS version and name**: Ubuntu 22.04.3 LTS (running in WSL2)\n- **Pendulum version**: 3.0.0\n\n## Issue\n\nWhen a naive pendulum.DateTime calls `diff` with a stdlib datetime object the input is converted to a pendulum instance, but it defaults to having a timezone of UTC, causing a TypeError\n\n`TypeError: can't compare offset-naive and offset-aware datetimes`\n\nRepro\n\n```python\nfrom datetime import datetime\n\nimport pendulum\n\npendulum_today = pendulum.today().naive()\nstdlib_today = datetime.today()\n\nprint(pendulum_today.tzinfo)\nprint(stdlib_today.tzinfo)\n\npendulum_today.diff(stdlib_today)\n```","author":{"url":"https://github.com/NodeJSmith","@type":"Person","name":"NodeJSmith"},"datePublished":"2025-03-12T14:34:35Z","url":"https://github.com/python-pendulum/pendulum/issues/880"}
| 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:71671153-a937-d5d6-536a-dd3197d1888b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D0C0:1E7453:120632:1977B3:6B0464A3 |
| html-safe-nonce | cade56f1f29379082d02689101d3182cc156bac57d084b90f0a09c820bd30336 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMEMwOjFFNzQ1MzoxMjA2MzI6MTk3N0IzOjZCMDQ2NEEzIiwidmlzaXRvcl9pZCI6IjY5ODg5NDA3MjkxMTI2MTgxNDciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7555bfd260d52176bb35bb8b8e940ba11298535d714ce986d812aceca7ea7b6d |
| hovercard-subject-tag | issue:2914194737 |
| 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/880/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2ca2bda73ef7c76224ea1abc0530343e830cef45a36298879b03d4eca29a72bc/python-pendulum/pendulum/issues/880 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2ca2bda73ef7c76224ea1abc0530343e830cef45a36298879b03d4eca29a72bc/python-pendulum/pendulum/issues/880 |
| 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: Ubuntu 22.04.3 LTS (running in WSL2) Pendulum version: 3.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | NodeJSmith |
| hostname | github.com |
| expected-hostname | github.com |
| None | 83e4c0e58c5162177f3c161c5fbad38527ae04c11ac14980f9f9d85ae2027b1f |
| 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 | ca4d07a7cef4e4b75f821dc25e7300d80c1450a9 |
| ui-target | canary-2 |
| 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