Always cast post datetimes to dates on render

This commit is contained in:
Fabio Manganiello 2024-04-11 01:10:25 +02:00
parent d517416077
commit 817b23ac69

View file

@ -69,12 +69,9 @@ class BlogApp(Flask):
break break
if m.group(1) == "published": if m.group(1) == "published":
try: metadata[m.group(1)] = datetime.datetime.fromisoformat(
metadata[m.group(1)] = datetime.date.fromisoformat(m.group(2)) m.group(2)
except ValueError: ).date()
metadata[m.group(1)] = datetime.datetime.fromisoformat(
m.group(2)
)
else: else:
metadata[m.group(1)] = m.group(2) metadata[m.group(1)] = m.group(2)