From 44559be72bbf3024546bb75edcc629b74ceda767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Tue, 30 Jul 2024 17:50:42 -0600 Subject: [PATCH] fix: Date fields are now properly serialized as ISO dates, i.e. "YYYY-MM-DD" --- singer_sdk/helpers/_typing.py | 2 +- tests/core/test_typing.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/singer_sdk/helpers/_typing.py b/singer_sdk/helpers/_typing.py index 2ccb9c471..1e7370fd9 100644 --- a/singer_sdk/helpers/_typing.py +++ b/singer_sdk/helpers/_typing.py @@ -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 diff --git a/tests/core/test_typing.py b/tests/core/test_typing.py index 66182c52d..5043c75e1 100644 --- a/tests/core/test_typing.py +++ b/tests/core/test_typing.py @@ -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"})