Jump to solution
Verify

The Fix

pip install pydantic==1.10.1

Based on closed pydantic/pydantic issue #8964 · PR/commit linked

Jump to Verify Open PR/Commit
@@ -1,5 +1,5 @@ docutils==0.13.1 Pygments==2.2.0 -Sphinx==1.6.2 +Sphinx==1.6.3 sphinxcontrib-spelling==2.3.0
repro.py
from datetime import datetime from dateutil.parser import isoparse from pydantic import TypeAdapter iso_str = "2024-03-06T14:21:34-00:08" expected = isoparse(iso_str) datetime_adapter = TypeAdapter(datetime) actual_datetime = datetime_adapter.validate_python(iso_str) assert actual_datetime == expected python_dump = datetime_adapter.dump_python(actual_datetime, mode="python") assert python_dump == expected, (python_dump, expected) json_dump = datetime_adapter.dump_python(actual_datetime, mode="json") assert json_dump == iso_str, ( json_dump, iso_str, ) # fails with ('2024-03-06T14:21:34+00:08', '2024-03-06T14:21:34-00:08') # ^ ^
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Upgrade to fixed release\npip install pydantic==1.10.1\nWhen NOT to use: Do not use this fix if the application relies on the incorrect timezone behavior.\n\n

Why This Fix Works in Production

  • Trigger: assert actual_datetime == expected
  • Mechanism: The datetime dumping to JSON incorrectly flips the sign of the timezone
  • Why the fix works: Fixed a bug where datetime dumping to JSON flipped the sign of the timezone. (first fixed release: 1.10.1).
Production impact:
  • If left unfixed, this can cause silent data inconsistencies that propagate (bad cache entries, incorrect downstream decisions).

Why This Breaks in Prod

  • The datetime dumping to JSON incorrectly flips the sign of the timezone
  • Production symptom (often without a traceback): assert actual_datetime == expected

Proof / Evidence

  • GitHub issue: #8964
  • Fix PR: https://github.com/pydantic/speedate/pull/56
  • First fixed release: 1.10.1
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-09
  • Confidence: 0.70
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.51

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“@FynnBe, Thanks for reporting! Indeed, this is a bug. Probably needs to be fixed in pydantic-core. I'll take a look today!”
@sydney-runkle · 2024-03-07 · confirmation · source
“Fixed this in speedate, will be released with pydantic v2.7.0!”
@sydney-runkle · 2024-03-12 · confirmation · source
“I can confirm that this is a bug in how speedate converts timezone info objects to strings :). I'll contribute a fix soon!”
@sydney-runkle · 2024-03-07 · source

Failure Signature (Search String)

  • assert actual_datetime == expected
  • assert python_dump == expected, (python_dump, expected)
Copy-friendly signature
signature.txt
Failure Signature ----------------- assert actual_datetime == expected assert python_dump == expected, (python_dump, expected)

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- assert actual_datetime == expected assert python_dump == expected, (python_dump, expected)

Minimal Reproduction

repro.py
from datetime import datetime from dateutil.parser import isoparse from pydantic import TypeAdapter iso_str = "2024-03-06T14:21:34-00:08" expected = isoparse(iso_str) datetime_adapter = TypeAdapter(datetime) actual_datetime = datetime_adapter.validate_python(iso_str) assert actual_datetime == expected python_dump = datetime_adapter.dump_python(actual_datetime, mode="python") assert python_dump == expected, (python_dump, expected) json_dump = datetime_adapter.dump_python(actual_datetime, mode="json") assert json_dump == iso_str, ( json_dump, iso_str, ) # fails with ('2024-03-06T14:21:34+00:08', '2024-03-06T14:21:34-00:08') # ^ ^

Environment

  • Pydantic: 2

What Broke

JSON output shows incorrect timezone sign, leading to potential data misinterpretation.

Why It Broke

The datetime dumping to JSON incorrectly flips the sign of the timezone

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install pydantic==1.10.1

When NOT to use: Do not use this fix if the application relies on the incorrect timezone behavior.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Fix reference: https://github.com/pydantic/speedate/pull/56

First fixed release: 1.10.1

Last verified: 2026-02-09. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • Do not use this fix if the application relies on the incorrect timezone behavior.

Verify Fix

verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.

Did This Fix Work in Your Case?

Quick signal helps us prioritize which fixes to verify and improve.

Prevention

  • Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
  • Upgrade behind a canary and run integration tests against the canary before 100% rollout.

Version Compatibility Table

VersionStatus
1.10.1 Fixed

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.