Skip to content

Add exception handling for unknown timezone in date parsing (ignore timezone in that case)

Niklas Mertsch requested to merge (removed):master into master

datetime.strptime(date_string, format_string) can only parse locally known timezones. Some environments (like docker containers used in GitLab CI) only know a few timezones, so parsing a date_string can fail in some restricted environments.

This patch adds an except block: if strptime failed to parse a date, try again without the timezone. This leads to loss of information (the timezone offset), but without providing a timezone database (like zoneinfo from Python 3.9), this information cannot be used.

Merge request reports

Loading