Fix autoupdate time compare (#4897)
* Fix autoupdate time compare Make sure both timestamps are UTC, otherwise Python complains with: TypeError: can't compare offset-naive and offset-aware datetimes * Use correect attribute --------- Co-authored-by: Pascal Vizeli <pvizeli@syshack.ch>
This commit is contained in:
parent
52e0c7e484
commit
a71111b378
|
@ -22,6 +22,8 @@ from securetar import atomic_contents_add, secure_path
|
|||
import voluptuous as vol
|
||||
from voluptuous.humanize import humanize_error
|
||||
|
||||
from supervisor.utils.dt import utc_from_timestamp
|
||||
|
||||
from ..bus import EventListener
|
||||
from ..const import (
|
||||
ATTR_ACCESS_TOKEN,
|
||||
|
@ -349,7 +351,7 @@ class Addon(AddonModel):
|
|||
@property
|
||||
def latest_version_timestamp(self) -> datetime:
|
||||
"""Return when latest version was first seen."""
|
||||
return datetime.fromtimestamp(self.data_store[ATTR_VERSION_TIMESTAMP])
|
||||
return utc_from_timestamp(self.data_store[ATTR_VERSION_TIMESTAMP])
|
||||
|
||||
@property
|
||||
def protected(self) -> bool:
|
||||
|
|
|
@ -10,6 +10,8 @@ from typing import Any
|
|||
|
||||
from awesomeversion import AwesomeVersion, AwesomeVersionException
|
||||
|
||||
from supervisor.utils.dt import utc_from_timestamp
|
||||
|
||||
from ..const import (
|
||||
ATTR_ADVANCED,
|
||||
ATTR_APPARMOR,
|
||||
|
@ -227,7 +229,7 @@ class AddonModel(JobGroup, ABC):
|
|||
@property
|
||||
def latest_version_timestamp(self) -> datetime:
|
||||
"""Return when latest version was first seen."""
|
||||
return datetime.fromtimestamp(self.data[ATTR_VERSION_TIMESTAMP])
|
||||
return utc_from_timestamp(self.data[ATTR_VERSION_TIMESTAMP])
|
||||
|
||||
@property
|
||||
def version(self) -> AwesomeVersion:
|
||||
|
|
Loading…
Reference in New Issue