diff options
author | Yobmod <yobmod@gmail.com> | 2021-08-02 16:30:32 +0100 |
---|---|---|
committer | Yobmod <yobmod@gmail.com> | 2021-08-02 16:30:32 +0100 |
commit | 730f11936364314b76738ed06bdd9222dc9de2ac (patch) | |
tree | 31f1b18a178831552dc42a58a32db4055c0bc202 /git/objects/util.py | |
parent | 13e0730b449e8ace2c7aa691d588febb4bed510c (diff) | |
download | gitpython-730f11936364314b76738ed06bdd9222dc9de2ac.tar.gz |
Fix parse_date typing 2
Diffstat (limited to 'git/objects/util.py')
-rw-r--r-- | git/objects/util.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/git/objects/util.py b/git/objects/util.py index d7472b5d..e3e7d3ba 100644 --- a/git/objects/util.py +++ b/git/objects/util.py @@ -182,9 +182,11 @@ def parse_date(string_date: Union[str, datetime]) -> Tuple[int, int]: :note: Date can also be YYYY.MM.DD, MM/DD/YYYY and DD.MM.YYYY. """ if isinstance(string_date, datetime): - if string_date.tzinfo: + if string_date.tzinfo and string_date.utcoffset(): utcoffset = string_date.utcoffset() offset = -int(utcoffset.total_seconds()) if utcoffset else 0 + else: + offset = 0 return int(string_date.astimezone(utc).timestamp()), offset else: assert isinstance(string_date, str), f"string_date={string_date}, type={type(string_date)}" # for mypy |