Skip to content

Commit

Permalink
[BitBucket] Fix error with timezone formatting (#1441)
Browse files Browse the repository at this point in the history
* [BitBucket] Fix error with timezone formatting

* reformat for black
  • Loading branch information
CrispyCB authored Aug 9, 2024
1 parent b866ae7 commit 4fc8a83
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion atlassian/bitbucket/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ def get_time(self, id):
# The format contains a : in the timezone which is supported from 3.7 on.
if sys.version_info <= (3, 7):
value_str = RE_TIMEZONE.sub(r"\1\2", value_str)
value = datetime.strptime(value_str, self.CONF_TIMEFORMAT)
try:
value = datetime.strptime(value_str, self.CONF_TIMEFORMAT)
except ValueError:
value = datetime.strptime(value_str, "%Y-%m-%dT%H:%M:%S.%fZ", tzinfo="UTC")
else:
value = value_str

Expand Down

0 comments on commit 4fc8a83

Please sign in to comment.