Skip to content

Commit 46377c7

Browse files
fix: improve AirbyteDateTime.__add__ to properly check input type
Co-Authored-By: Aaron <AJ> Steers <[email protected]>
1 parent eddec7b commit 46377c7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

airbyte_cdk/utils/datetime_helpers.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,10 @@ def __add__(self, other: timedelta) -> "AirbyteDateTime":
219219
Raises:
220220
TypeError: If other is not a timedelta.
221221
"""
222-
result = super().__add__(other)
223-
if isinstance(result, datetime):
224-
return AirbyteDateTime.from_datetime(result)
222+
if isinstance(other, timedelta):
223+
result = super().__add__(other)
224+
if isinstance(result, datetime):
225+
return AirbyteDateTime.from_datetime(result)
225226
raise TypeError("Invalid operation")
226227

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

0 commit comments

Comments
 (0)