Point72 / csp

csp is a high performance reactive stream processing library, written in C++ and Python
https://github.com/Point72/csp/wiki
Apache License 2.0
150 stars 27 forks source link

Fix to_json to parse None in datetimes correctly #268

Closed arhamchopra closed 4 weeks ago

arhamchopra commented 1 month ago

This PR fixes an issue in to_json for parsing None in datetime types like Date, Time, DateTime, TimeDelta.

class E(csp.Struct):
  a: datetime.datetime
  b: datetime.date
  c: datetime.time
  d: datetime.timedelta
e = E(a=None, b=None, c=None, d=None)
e.to_json() # "{'a': null, 'b': null, 'c': null, 'd': null}"