From f101f825a3aeaa38490b30ab1385941d488fcbe9 Mon Sep 17 00:00:00 2001 From: mitsuha_s Date: Sun, 10 Jul 2022 16:10:52 +0000 Subject: [PATCH] fix representation date in FeedItem --- rss.py | 4 ++-- telegram.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/rss.py b/rss.py index eeeaa01..fa39cce 100644 --- a/rss.py +++ b/rss.py @@ -1,5 +1,5 @@ from logging import Logger - +from time import strftime from feedparser import FeedParserDict, parse @@ -9,7 +9,7 @@ class FeedItem: self.title = item.get('title', '') self.description = item.get('summary', '') if 'published' in item: - self.date = item.published_parsed + self.date = strftime("%d.%m.%Y %H:%M", item.published_parsed) else: self.date = None diff --git a/telegram.py b/telegram.py index 7860b45..d43a92a 100644 --- a/telegram.py +++ b/telegram.py @@ -165,7 +165,8 @@ class Notifier: def __format_message(self, item: FeedItem) -> str: return ( # TODO: Return date when FeedItem starts to return formattable datetime object - f"{item.title}\n\n" + f"{item.title}\n" + f"{item.date}\n\n" f"{self.__sanitize_html(item.description)}" )