From 4ab6dce0aeee0abaddc473459fcb6c2bc85a971c Mon Sep 17 00:00:00 2001 From: Luke Date: Sat, 9 Sep 2023 16:51:02 -0400 Subject: [PATCH] fix: timezone for non-3.11 --- roborock/containers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roborock/containers.py b/roborock/containers.py index aa70cf9..3dd8e55 100644 --- a/roborock/containers.py +++ b/roborock/containers.py @@ -6,7 +6,7 @@ from dataclasses import asdict, dataclass from enum import Enum from typing import Any, NamedTuple - +from datetime import timezone from dacite import Config, from_dict from .code_mappings import ( @@ -427,9 +427,9 @@ class CleanRecord(RoborockBase): def __post_init__(self) -> None: self.square_meter_area = round(self.area / 1000000, 1) if self.area is not None else None self.begin_datetime = ( - datetime.datetime.fromtimestamp(self.begin).astimezone(datetime.UTC) if self.begin else None + datetime.datetime.fromtimestamp(self.begin).astimezone(timezone.utc) if self.begin else None ) - self.end_datetime = datetime.datetime.fromtimestamp(self.end).astimezone(datetime.UTC) if self.end else None + self.end_datetime = datetime.datetime.fromtimestamp(self.end).astimezone(timezone.utc) if self.end else None @dataclass