You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is a known issue that when using GCS shell client the last_modification_date method will return a datetime with maybe wrong timezone when the client and server timezone is different.
This is due to the fact that datetime.strptime does not read the timezone when %Z is used.
My design idea was that last_modification_date should return a datetime object with tzinfo which should make sure that handling of different time zones is possible by the code calling the function.
I extended now the existing unit tests that the returned datetime must include tzinfo.
The issue here is that the gsutil tool used in the GoogleCloudStorageShellClient class returns a date time string with a text timezone. Sample: Sat, 14 Nov 2020 10:39:09 EST
I use the function datetime.strptime to parse the date time, but this method does not support reading the timezone as text. The official parameter %Z is used, but this parameter does not write the tzinfo to the datetime object.
To fix this, I added datetime.astimezone() which adds the local timezone. But the local timezone can be different as the timezone returned from the gsutil. gsutil returns the server timezone from the google cloud region as far as I can see.
We have to find another way of parsting date time with the timezone as text. This is what this issue is about. Maybe another python module must be used here since the standard module does not support this.
p.s. about the timezone parameter I suggest to remove it, see here mara/mara-db#44
It is a known issue that when using GCS shell client the
last_modification_date
method will return a datetime with maybe wrong timezone when the client and server timezone is different.This is due to the fact that
datetime.strptime
does not read the timezone when%Z
is used.code ref
The text was updated successfully, but these errors were encountered: