| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -181,13 +181,11 @@ def parse_date(string_date: Union[str, datetime]) -> Tuple[int, int]: | |||
| 181 | 181 | :raise ValueError: If the format could not be understood | |
| 182 | 182 | :note: Date can also be YYYY.MM.DD, MM/DD/YYYY and DD.MM.YYYY. | |
| 183 | 183 | """ | |
| 184 | - if isinstance(string_date, datetime): | ||
| 185 | - if string_date.tzinfo and string_date.utcoffset(): | ||
| 186 | - utcoffset = string_date.utcoffset() | ||
| 187 | - offset = -int(utcoffset.total_seconds()) if utcoffset else 0 | ||
| 188 | - else: | ||
| 189 | - offset = 0 | ||
| 184 | + if isinstance(string_date, datetime) and string_date.tzinfo: | ||
| 185 | + utcoffset = string_date.utcoffset() | ||
| 186 | + offset = -int(utcoffset.total_seconds()) if utcoffset else 0 | ||
| 190 | 187 | return int(string_date.astimezone(utc).timestamp()), offset | |
| 188 | + | ||
| 191 | 189 | else: | |
| 192 | 190 | assert isinstance(string_date, str), f"string_date={string_date}, type={type(string_date)}" # for mypy | |
| 193 | 191 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments