diff --git a/src/feather/data.py b/src/feather/data.py index a6af71f..4117545 100644 --- a/src/feather/data.py +++ b/src/feather/data.py @@ -38,7 +38,7 @@ def sanitize_filename( return filename[:cutoff] + "…" + insert_before_suffix + suffix -def format_datetime(config: Config, timestamp: int) -> str: +def format_datetime(config: Config, timestamp: float) -> str: """Format a timestamp according to the configuration.""" if timestamp < 0: date = datetime(1970, 1, 1, tzinfo=config.timezone) + timedelta( @@ -103,8 +103,8 @@ class Article(ABC): # with default value unread: bool = True # if the article is unread title: str = "" # article title - published: int = 0 # article publication time (timestamp) - updated: int = 0 # article update time (timestamp) + published: float = 0.0 # article publication time (timestamp) + updated: float = 0.0 # article update time (timestamp) author: str = "" # article author summary: str = "" # article summary (HTML) content: str = "" # article content (HTML) @@ -116,7 +116,7 @@ class Article(ABC): comments_url: str = "" # article comments URL language: str = "" # article language image_url: str = "" # article main image - last_write: int = 0 # last time this article file was written (timestamp) + last_write: float = 0.0 # last time this article file was written (timestamp) def _hash_id(self): return sha256(str(self.id).encode("utf-8")).hexdigest() @@ -231,7 +231,7 @@ class Article(ABC): html_path, config.article_template.render(self._get_template_dict()) ) # set accessed date to update time, modified to publication time - os.utime(html_path, (max(self.published, self.updated), self.published)) + os.utime(html_path, (max(int(self.published), int(self.updated)), int(self.published))) def _delete_html(self, missing_ok=False): """Delete the HTML file associated with this article."""