Skip to content

Commit

Permalink
Deserialize to UTC date (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
msinto93 authored Mar 11, 2024
2 parents 11e4550 + d8e0210 commit c7a2a6a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/py_adapter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ def _parse_date(self, data: Union[datetime.date, int, str], schema: avro.schema.
if isinstance(data, int):
# Assume we have serialized as a timestamp in milliseconds. Now that is NOT how we would have serialized it
# if it was Avro. So this is useful only in combination with serializing using ``datetime_type=int``.
return datetime.date.fromtimestamp(data / 1e3)
return datetime.datetime.fromtimestamp(data / 1e3, tz=datetime.timezone.utc).date()
elif isinstance(data, str):
return dateutil.parser.isoparse(data).date()
else:
Expand Down

0 comments on commit c7a2a6a

Please sign in to comment.