AllenNeuralDynamics / Aind.Behavior.Services

https://allenneuraldynamics.github.io/Aind.Behavior.Services/
MIT License
0 stars 0 forks source link

`datetime` types silently drop timezone information on pydantic model serialization #41

Open bruno-f-cruz opened 4 months ago

bruno-f-cruz commented 4 months ago

Pydantic seems to silently drop tz information. (https://github.com/pydantic/pydantic/issues/9571. This is rather annoying as the serialization behavior from the csharp generated classes correctly honors the timezone information.

Moving forward we should also just consider enforcing tz information via the AwareDatetime pydantic type (https://docs.pydantic.dev/2.0/usage/types/datetime/)