Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to_json to parse None in datetimes correctly #268

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

arhamchopra
Copy link
Collaborator

@arhamchopra arhamchopra commented Jun 6, 2024

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}"

Signed-off-by: Arham Chopra <arham.chopra@cubistsystematic.com>
@arhamchopra arhamchopra force-pushed the ac/fix_to_json_none_datetime branch from 3e10e49 to d8fef5c Compare June 6, 2024 04:36
@arhamchopra arhamchopra marked this pull request as ready for review June 6, 2024 13:20
@arhamchopra arhamchopra merged commit 234f94c into main Jun 6, 2024
29 checks passed
@arhamchopra arhamchopra deleted the ac/fix_to_json_none_datetime branch June 6, 2024 14:11
@timkpaine timkpaine added the type: bug Concrete, reproducible bugs label Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Concrete, reproducible bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants