diff --git a/etiquette/helpers.py b/etiquette/helpers.py index e99e745..1eae8b0 100644 --- a/etiquette/helpers.py +++ b/etiquette/helpers.py @@ -456,7 +456,7 @@ def split_easybake_string(ebstring) -> tuple[str, str, str]: tagname = tagname.strip('.') return (tagname, synonym, rename_to) -def timestamp_to_datetime(unix): +def utcfromtimestamp(unix): return datetime.datetime.utcfromtimestamp(unix).replace(tzinfo=datetime.timezone.utc) def zip_album(album, recursive=True) -> zipstream.ZipFile: diff --git a/etiquette/objects.py b/etiquette/objects.py index 42a0efa..1604d21 100644 --- a/etiquette/objects.py +++ b/etiquette/objects.py @@ -81,7 +81,7 @@ class ObjectBase(worms.Object): def created(self) -> datetime.datetime: if self._created_dt is not None: return self._created_dt - self._created_dt = helpers.timestamp_to_datetime(self.created_unix) + self._created_dt = helpers.utcfromtimestamp(self.created_unix) return self._created_dt class GroupableMixin(metaclass=abc.ABCMeta): @@ -1512,7 +1512,7 @@ class Photo(ObjectBase): def tagged_at(self) -> datetime.datetime: if self._tagged_at_dt is not None: return self._tagged_at_dt - self._tagged_at_dt = helpers.timestamp_to_datetime(self.tagged_at_unix) + self._tagged_at_dt = helpers.utcfromtimestamp(self.tagged_at_unix) return self._tagged_at_dt class Tag(ObjectBase, GroupableMixin):