Skip to content

Commit 43bce33

Browse files
fix: update to_datetime to return standard datetime object
Co-Authored-By: Aaron <AJ> Steers <[email protected]>
1 parent db3c1b9 commit 43bce33

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

airbyte_cdk/utils/datetime_helpers.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,13 @@ def from_datetime(cls, dt: datetime) -> "AirbyteDateTime":
141141
def to_datetime(self) -> datetime:
142142
"""Converts this AirbyteDateTime to a standard datetime object.
143143
144-
Today, this just returns `self` because AirbyteDateTime is a subclass of `datetime`.
145-
In the future, we may modify our internal representation to use a different base class.
144+
Returns a standard datetime object with the same attributes as this AirbyteDateTime.
146145
"""
147-
return self
146+
return datetime(
147+
self.year, self.month, self.day,
148+
self.hour, self.minute, self.second, self.microsecond,
149+
tzinfo=self.tzinfo
150+
)
148151

149152
def __str__(self) -> str:
150153
"""Returns the datetime in ISO8601/RFC3339 format with 'T' delimiter.

0 commit comments

Comments
 (0)