Skip to content

Commit 6dcf9f4

Browse files
authored
chore: include ms in transforming datetime to UTC string (#518)
While testing client, I noticed that we didn't include ms during transformation of `datetime` to UTC string. This PR improves improves conversion to UTC string.
1 parent f1d0cbb commit 6dcf9f4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/apify_client/_http_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ def _parse_params(params: dict | None) -> dict | None:
8080
elif isinstance(value, datetime):
8181
utc_aware_dt = value.astimezone(timezone.utc)
8282

83+
iso_str = utc_aware_dt.isoformat(timespec='milliseconds')
84+
8385
# Convert to ISO 8601 string in Zulu format
84-
zulu_date_str = utc_aware_dt.strftime('%Y-%m-%dT%H:%M:%SZ')
86+
zulu_date_str = iso_str.replace('+00:00', 'Z')
8587

8688
parsed_params[key] = zulu_date_str
8789
elif value is not None:

0 commit comments

Comments
 (0)