Update timestamp handling (#314)
Co-authored-by: DevilXD <DevilXD@users.noreply.github.com>
This commit is contained in:
1 parent
6b9aabb252
commit
2dd7a57344
1 file changed
+4
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user