diff --git a/src/routes/index.py b/src/routes/index.py index bc83c88..7c12231 100644 --- a/src/routes/index.py +++ b/src/routes/index.py @@ -21,10 +21,7 @@ def index() -> str: def linkify(s): return ".".join(titleify(s).split(".")[:-1]) - def datify(s): - return s[:-14] + " " + s[-4:] - - posts.append((linkify(p), titleify(p), datify(get_post_cdate(p)))) + posts.append((linkify(p), titleify(p), get_post_cdate(p))) return render_template( "index.html", diff --git a/src/utils/misc.py b/src/utils/misc.py index c105d3e..2f30d61 100644 --- a/src/utils/misc.py +++ b/src/utils/misc.py @@ -51,11 +51,17 @@ def get_post(filename: str) -> File | None: return None else: with open(filename, "r") as reader: - return File(reader.read(), get_post_cdate(filename)) + return File(reader.read(), get_post_cdatetime(filename)) + + +def get_post_cdatetime(filename: str) -> str: + return ctime(os_path.getmtime(filename)) def get_post_cdate(filename: str) -> str: - return ctime(os_path.getmtime(filename)) + dt = datetime.fromtimestamp(os_path.getmtime(filename)) + + return dt.strftime("%a %b %d %Y") def delete_post(filename: str) -> bool: