Skip to content

Conversation

hoesler
Copy link
Contributor

@hoesler hoesler commented Mar 6, 2025

This PR fixes the (de-)serialization of the pendulum Duration model.

The model now uses it's own custom serialization to ISO 8601, instead of delegating to the timedelta serialization which does not handle months. It further extends (de-)serialization of sub-seconds and negative durations.

fixes #295

@yezz123 yezz123 merged commit bde2512 into pydantic:main Mar 6, 2025
10 checks passed
@hoesler
Copy link
Contributor Author

hoesler commented Mar 6, 2025

Wow, that was fast. Thank you!

Unfortunately, I was just about to add a commit as I spotted a mistake in the test. Obviously I need to use json serialization for testing, not python. Sorry for that. Let me open another PR for this real quick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Months of a Duration are getting (de)serialized incorrectly

2 participants