Uh oh!
There was an error while loading. Please reload this page.
fix serialization of pendulum.DateTime objects in JsonSerializationWriter - #369
Conversation
5438a74 to
3278fe8CompareEran Avrahami (eran-av)
commented
Sep 24, 2024
@microsoft-github-policy-service agree |
Vincent Biret (@baywet), Andrew Omondi (@andrueastman) Can you please take a look? |
Vincent Biret (baywet)
left a comment
There was a problem hiding this comment.
Thanks for the contribution!
Can you please also bump the patch version in the version file and add a changelog entry? (today's date, changed) to ensure a swift release.
Also, sorry about the delay in reviewing, I missed this one in my many, many notifications...
Vincent Biret (baywet)
commented
Oct 3, 2024
Additionally, the code needs to be formatted (see the build logs) |
…/pendulum-datetime-serialization
Vincent Biret (baywet)
left a comment
There was a problem hiding this comment.
Thank you for making the changes!
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Vincent Biret (baywet)
commented
Oct 3, 2024
Eran Avrahami (@eran-av) it seems some unit tests are not passing, can you have a look into it please? |
Eran Avrahami (eran-av)
commented
Oct 3, 2024
Fixed it, |
Vincent Biret (baywet)
commented
Oct 3, 2024
yeah this is a bit confusing: pylint + yapf |



Environment
Describe the bug
The
write_any_valuemethod inJsonSerializationWriterfails to properly handlependulum.DateTimeobjects. This is due to insufficient type checking, which causespendulum.DateTimeobjects to be treated as non-primitive types instead of as datetime objects. Specifically, the issue stems from not usingisinstance()to check for datetime types, which preventspendulum.DateTimefrom being recognized as a subclass of the primitivedatetime.datetime.To Reproduce
JsonSerializationWriterinstancependulum.DateTimefield (specifically as anadditional_datadict)pendulum.DateTimeobject is not serialized correctlyExpected behavior
pendulum.DateTimeobjects should be treated as datetime objects and serialized correctly, just likedatetime.datetimeobjects. The serialization process should recognizependulum.DateTimeas a subclass ofdatetime.datetimeand handle it accordingly.Code to reproduce