shayypy / guilded.py

Asynchronous Guilded API wrapper for Python
https://guildedpy.rtfd.io
Other
135 stars 25 forks source link

fix for ValueError in utils.ISO8601 #17

Closed anytarseir67 closed 3 years ago

anytarseir67 commented 3 years ago

fromisoformat was added to better deal with timestamps from datetime, but the default datetime timestamp has 6 spaces for milliseconds not 5. current version raises a ValueError.

i would also like to mention that fromisoformat does in fact accept milliseconds, but only the "proper" 6 and 3 digit representations. YesItDoes 3digit

also, despite the fact that i also used it here, millisecond isn't really the proper term for that section of numbers; the first 4 digits are milliseconds, but anything after in a normal timestamp would be referring to microseconds

shayypy commented 3 years ago

but only the "proper" 6 and 3 digit representations.

This is unfortunate - I wonder if a better solution would be to transform received milliseconds/microseconds into 6 digits with zero-padding so as to retain the specificity. I recently received a timestamp which ended in 4 digits of milliseconds, which is what prompted me to make this change.

Regardless, 5 was an arbitrary number of digits for me to use and I suppose I should have done some more research about milliseconds in ISO8601 datetimes.