Skip to content

Commit

Permalink
fix(generator): don't truncate datetime field precision
Browse files Browse the repository at this point in the history
closes RobertCraigie#804

- [ ] Unit tests for the changes exist
- [ ] Tests pass without significant drop in coverage
- [ ] Documentation reflects changes where applicable
- [ ] Test snapshots have been
[updated](https://prisma-client-py.readthedocs.io/en/latest/contributing/contributing/#snapshot-tests)
if applicable

By submitting this pull request, I confirm that you can use, modify,
copy and redistribute this contribution, under the terms of your choice.
  • Loading branch information
Oblynx committed Aug 21, 2023
1 parent 0bc9f95 commit c041d45
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/prisma/generator/templates/builder.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -810,9 +810,6 @@ def serialize_datetime(dt: datetime.datetime) -> str:
elif dt.tzinfo != timezone.utc:
dt = dt.astimezone(timezone.utc)

# truncate microseconds to 3 decimal places
# https://github.com/RobertCraigie/prisma-client-py/issues/129
dt = dt.replace(microsecond=int(dt.microsecond / 1000) * 1000)
return dt.isoformat()


Expand Down

0 comments on commit c041d45

Please sign in to comment.