Fix date representation in FeedItem #38
5
rss.py
5
rss.py
|
@ -1,5 +1,6 @@
|
|||
from logging import Logger
|
||||
from time import strftime
|
||||
from datetime import datetime
|
||||
from time import mktime
|
||||
from feedparser import FeedParserDict, parse
|
||||
|
||||
|
||||
|
@ -9,7 +10,7 @@ class FeedItem:
|
|||
self.title = item.get('title', '')
|
||||
self.description = item.get('summary', '')
|
||||
if 'published' in item:
|
||||
self.date = strftime("%d.%m.%Y %H:%M", item.published_parsed)
|
||||
self.date = datetime.fromtimestamp(mktime(item.published_parsed))
|
||||
else:
|
||||
self.date = None
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ class Notifier:
|
|||
def __format_message(self, item: FeedItem) -> str:
|
||||
return (
|
||||
f"<strong><a href=\"{item.url}\">{item.title}</a></strong>\n"
|
||||
f"{item.date}\n\n"
|
||||
f"{item.date.strftime('%m.%d.%Y %H:%M')}\n\n"
|
||||
f"{self.__sanitize_html(item.description)}"
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue