legacy google takeout: fix timezone localization
This commit is contained in:
parent
d5fccf1874
commit
9e72672b4f
1 changed files with 5 additions and 2 deletions
|
@ -5,12 +5,14 @@ Google Takeout exports: browsing history, search/youtube/google play activity
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
import re
|
import re
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime
|
||||||
from html.parser import HTMLParser
|
from html.parser import HTMLParser
|
||||||
from typing import List, Optional, Any, Callable, Iterable, Tuple
|
from typing import List, Optional, Any, Callable, Iterable, Tuple
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from urllib.parse import unquote
|
from urllib.parse import unquote
|
||||||
|
|
||||||
|
import pytz
|
||||||
|
|
||||||
from ...core.time import abbr_to_timezone
|
from ...core.time import abbr_to_timezone
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,7 +31,8 @@ def parse_dt(s: str) -> datetime:
|
||||||
# old takeouts didn't have timezone
|
# old takeouts didn't have timezone
|
||||||
# hopefully it was utc? Legacy, so no that much of an issue anymore..
|
# hopefully it was utc? Legacy, so no that much of an issue anymore..
|
||||||
# todo although maybe worth adding timezone from location provider?
|
# todo although maybe worth adding timezone from location provider?
|
||||||
tz = timezone.utc
|
# note: need to use pytz here for localize call later
|
||||||
|
tz = pytz.utc
|
||||||
else:
|
else:
|
||||||
s, tzabbr = s.rsplit(maxsplit=1)
|
s, tzabbr = s.rsplit(maxsplit=1)
|
||||||
tz = abbr_to_timezone(tzabbr)
|
tz = abbr_to_timezone(tzabbr)
|
||||||
|
|
Loading…
Add table
Reference in a new issue