Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 730f119

Browse files
committedAug 2, 2021
Fix parse_date typing 2
1 parent 13e0730 commit 730f119

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎git/objects/util.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,11 @@ def parse_date(string_date: Union[str, datetime]) -> Tuple[int, int]:
182182
:note: Date can also be YYYY.MM.DD, MM/DD/YYYY and DD.MM.YYYY.
183183
"""
184184
if isinstance(string_date, datetime):
185-
if string_date.tzinfo:
185+
if string_date.tzinfo and string_date.utcoffset():
186186
utcoffset = string_date.utcoffset()
187187
offset = -int(utcoffset.total_seconds()) if utcoffset else 0
188+
else:
189+
offset = 0
188190
return int(string_date.astimezone(utc).timestamp()), offset
189191
else:
190192
assert isinstance(string_date, str), f"string_date={string_date}, type={type(string_date)}" # for mypy

0 commit comments

Comments
 (0)
Please sign in to comment.