Title: `from_timestamp` fails with timestamps earlier than 12h before unix epoch · Issue #956 · python-pendulum/pendulum · GitHub
Open Graph Title: `from_timestamp` fails with timestamps earlier than 12h before unix epoch · Issue #956 · python-pendulum/pendulum
X Title: `from_timestamp` fails with timestamps earlier than 12h before unix epoch · Issue #956 · 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: Win11 Pendulum version: 3.2.0 Issue pendulum.from_timestamp() throws OSError when attempting to c...
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: Win11 Pendulum version: 3.2.0 Issue pendulum.from_timesta...
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: Win11 Pendulum version: 3.2.0 Issue pendulum.from_timesta...
Opengraph URL: https://github.com/python-pendulum/pendulum/issues/956
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`from_timestamp` fails with timestamps earlier than 12h before unix epoch","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**: Win11\n- **Pendulum version**: 3.2.0\n\n## Issue\n`pendulum.from_timestamp()` throws OSError when attempting to convert a timestamps earlier than 12h before the unix epoch.\n\n```python\n>>> pendulum.from_timestamp(-43200)\nDateTime(1969, 12, 31, 12, 0, 0, tzinfo=Timezone('UTC'))\n>>> pendulum.from_timestamp(-43201)\nTraceback (most recent call last):\n File \"\u003cpython-input-5>\", line 1, in \u003cmodule>\n from_timestamp(-43201)\n ~~~~~~~~~~~~~~^^^^^^^^\n File \"C:\\sst\\reportsgenservice\\.venv\\Lib\\site-packages\\pendulum\\__init__.py\", line 290, in from_timestamp\n dt = _datetime.datetime.fromtimestamp(timestamp, tz=UTC)\nOSError: [Errno 22] Invalid argument\n```\n\nHowever, pendulum supports these dates without issues, for instance when parsing 0 dates from a database:\n```python\n>>> pendulum.parse('1900-01-01')\nDateTime(1900, 1, 1, 0, 0, 0, tzinfo=Timezone('UTC'))\n```\n\nCurrent workaround is to substract negative timestamps to an unix epoch datetime instance:\n```python\n>>> pendulum.from_timestamp(0).add(seconds=-43201)\nDateTime(1969, 12, 31, 11, 59, 59, tzinfo=Timezone('UTC'))\n```\n","author":{"url":"https://github.com/dr-eme","@type":"Person","name":"dr-eme"},"datePublished":"2026-04-03T15:51:50Z","url":"https://github.com/python-pendulum/pendulum/issues/956"}
| 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:f0718035-7ec2-1844-1aa7-8c7f003d310d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 98CE:2E00AA:111947:1849A5:6B04648A |
| html-safe-nonce | c11e1e12f830c28c64e6aa66a8a52adc4cabf223c46f5f8671164c5126f70459 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OENFOjJFMDBBQToxMTE5NDc6MTg0OUE1OjZCMDQ2NDhBIiwidmlzaXRvcl9pZCI6IjU5ODUzODcyNjQ5NTg4MTc0MTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 625b923336fa1f9e861e2031456949bc1a793afb1c300fbda4e767b1d35d052a |
| hovercard-subject-tag | issue:4201139163 |
| 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/956/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a028225db3c1e69d4127481f8f53aed050564f1075483f751e87c3eb28665690/python-pendulum/pendulum/issues/956 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a028225db3c1e69d4127481f8f53aed050564f1075483f751e87c3eb28665690/python-pendulum/pendulum/issues/956 |
| 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: Win11 Pendulum version: 3.2.0 Issue pendulum.from_timesta... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dr-eme |
| 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