Skip to content

Commit

Permalink
Update timestamp handling (#314)
Browse files Browse the repository at this point in the history
Co-authored-by: DevilXD <[email protected]>
  • Loading branch information
secretsoup and DevilXD authored Oct 9, 2023
1 parent 6b9aabb commit 2dd7a57
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ def json_minify(data: JsonType | list[JsonType]) -> str:


def timestamp(string: str) -> datetime:
return datetime.strptime(string, "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=timezone.utc)
try:
return datetime.strptime(string, "%Y-%m-%dT%H:%M:%S.%fZ").replace(tzinfo=timezone.utc)
except ValueError:
return datetime.strptime(string, "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=timezone.utc)


CHARS_ASCII = string.ascii_letters + string.digits
Expand Down

0 comments on commit 2dd7a57

Please sign in to comment.