Skip to content

Commit 09bdff2

Browse files
docs: add comment explaining why astimezone(utc) is needed before stripping tzinfo
Co-Authored-By: Daryna Ishchenko <darina.ishchenko17@gmail.com>
1 parent 7466576 commit 09bdff2

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

airbyte_cdk/sources/file_based/file_based_stream_reader.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ def _parse_start_date(self, start_date_str: str) -> datetime:
118118
try:
119119
return datetime.strptime(start_date_str, "%Y-%m-%dT%H:%M:%SZ")
120120
except ValueError:
121+
# ab_datetime_parse may return a timezone-aware datetime (e.g. for inputs
122+
# like "2025-01-01T00:00:00+05:30"). We convert to UTC first so the offset
123+
# is applied correctly, then strip tzinfo to produce a naive UTC datetime
124+
# compatible with RemoteFile.last_modified comparisons.
121125
return (
122126
ab_datetime_parse(start_date_str).astimezone(timezone.utc).replace(tzinfo=None)
123127
)

0 commit comments

Comments
 (0)