From 9e72672b4f765dc1807ac15990322a0a4087648b Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Sat, 3 Aug 2024 16:43:10 +0100 Subject: [PATCH] legacy google takeout: fix timezone localization --- my/google/takeout/html.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/my/google/takeout/html.py b/my/google/takeout/html.py index 5d65a86..d393957 100644 --- a/my/google/takeout/html.py +++ b/my/google/takeout/html.py @@ -5,12 +5,14 @@ Google Takeout exports: browsing history, search/youtube/google play activity from enum import Enum import re from pathlib import Path -from datetime import datetime, timezone +from datetime import datetime from html.parser import HTMLParser from typing import List, Optional, Any, Callable, Iterable, Tuple from collections import OrderedDict from urllib.parse import unquote +import pytz + from ...core.time import abbr_to_timezone @@ -29,7 +31,8 @@ def parse_dt(s: str) -> datetime: # old takeouts didn't have timezone # hopefully it was utc? Legacy, so no that much of an issue anymore.. # 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: s, tzabbr = s.rsplit(maxsplit=1) tz = abbr_to_timezone(tzabbr)