Skip to content

Commit db3c1b9

Browse files
fix: improve AirbyteDateTime.__add__ to convert to standard datetime first
Co-Authored-By: Aaron <AJ> Steers <[email protected]>
1 parent 46377c7 commit db3c1b9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

airbyte_cdk/utils/datetime_helpers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@ def __add__(self, other: timedelta) -> "AirbyteDateTime":
220220
TypeError: If other is not a timedelta.
221221
"""
222222
if isinstance(other, timedelta):
223-
result = super().__add__(other)
224-
if isinstance(result, datetime):
225-
return AirbyteDateTime.from_datetime(result)
223+
dt = self.to_datetime()
224+
result = dt + other
225+
return AirbyteDateTime.from_datetime(result)
226226
raise TypeError("Invalid operation")
227227

228228
def __radd__(self, other: timedelta) -> "AirbyteDateTime":

0 commit comments

Comments
 (0)