Skip to content

Commit

Permalink
fix: Date fields are now properly serialized as ISO dates, i.e. "YYYY…
Browse files Browse the repository at this point in the history
…-MM-DD" (#2580)
  • Loading branch information
edgarrmondragon authored Aug 6, 2024
1 parent 81d91f3 commit 87d78b3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion singer_sdk/helpers/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ def _conform_primitive_property( # noqa: PLR0911
if isinstance(elem, (datetime.datetime,)):
return to_json_compatible(elem)
if isinstance(elem, datetime.date):
return f"{elem.isoformat()}T00:00:00+00:00"
return elem.isoformat()
if isinstance(elem, datetime.timedelta):
epoch = datetime.datetime.fromtimestamp(0, UTC)
timedelta_from_epoch = epoch + elem
Expand Down
2 changes: 1 addition & 1 deletion tests/core/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def test_conform_primitives():
)
assert (
_conform_primitive_property(datetime.date(2020, 5, 17), {"type": "string"})
== "2020-05-17T00:00:00+00:00"
== "2020-05-17"
)
assert (
_conform_primitive_property(datetime.timedelta(365), {"type": "string"})
Expand Down

0 comments on commit 87d78b3

Please # to comment.