-
Notifications
You must be signed in to change notification settings - Fork 189
Suggestion: Explicit tzinfo in datetimes returned by SDK #90
Comments
I was noticing that my @xybu did you have a way to work around this and get the proper time? |
@KennethWilke I believe the server manages the field |
I understand that the server would manage that field, what's confusing me is why the time I get back doesn't match the time i see in the Web UI. |
For a more concrete example, i have a file, When I grab item.last_modified_date_time i get |
What's the value of |
Ah! That value does look like the proper UTC timestamp, thank you! :) Do you know what is different about the items own |
It seems the server updates |
Thank you for reaching out and for your patience. This SDK is being officially deprecated. See #209 for more information |
In the SDK, all datetimes (e.g.,
Item.file_system_info.last_modified_date_time
) returned misstzinfo
attribute. Although UTC is assumed (strictly speaking, this isn't true because OneDrive API explicitly returns UTC timezone byZ
) in OneDrive API, if the user does not pay extreme attention to timezone info and uses the value directly in some Python API where localtime is assumed whentzinfo
is missing (e.g.,datetime.datetime.timestamp()
), some issue can happen.If at all possible please make tzinfo explicitly UTC in the datetime objects returned. There are many fast and reliable ISO-8601 parsers out there and the slowest one is used (and in a lazy and incorrect way).
The text was updated successfully, but these errors were encountered: