Add time to feed display

This commit is contained in:
Carter McBride 2024-06-18 22:19:54 -06:00
parent 3023fbfb60
commit 56b8cef868
4 changed files with 136 additions and 134 deletions

View file

@ -1,13 +1,15 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head>
<head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>🦉 Bubo Reader</title> <title>🦉 Bubo Reader</title>
<link rel="stylesheet" href="/style.css" /> <link rel="stylesheet" href="/style.css" />
</head> </head>
<body>
<body>
<h1>🦉 Bubo Reader</h1> <h1>🦉 Bubo Reader</h1>
{% for group, feeds in data %} {% for group, feeds in data %}
@ -21,13 +23,8 @@
<ul> <ul>
{% for item in feed.items %} {% for item in feed.items %}
<li> <li>
{{ item.timestamp | formatDate }} - {{ item.timestamp | formatDate }} @ {{ item.timestamp | formatTime }}—
<a <a href="{{ item.link }}" target="_blank" rel="noopener norefferer nofollow">{{ item.title }}</a>
href="{{ item.link }}"
target="_blank"
rel="noopener norefferer nofollow"
>{{ item.title }}</a
>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
@ -47,10 +44,10 @@
<p>Last updated {{ now }}.</p> <p>Last updated {{ now }}.</p>
<p> <p>
Powered by Powered by
<a href="https://github.com/georgemandis/bubo-rss" <a href="https://github.com/georgemandis/bubo-rss">Bubo Reader (v{{ info.version }})</a>, a project by <a
>Bubo Reader (v{{ info.version }})</a href="https://george.mand.is">George Mandis</a>. ❤️
>, a project by <a href="https://george.mand.is">George Mandis</a>. ❤️
<a href="{{ info.funding.url }}">Sponsor on GitHub</a> <a href="{{ info.funding.url }}">Sponsor on GitHub</a>
</p> </p>
</body> </body>
</html> </html>

View file

@ -8,7 +8,7 @@
"scripts": { "scripts": {
"clean": "rm -rf dist", "clean": "rm -rf dist",
"build": "bun src/index.ts", "build": "bun src/index.ts",
"check": "biome check --write ./src ./eslint.config.js" "check": "biome check --write ./{src,config,public} ./eslint.config.js"
}, },
"author": { "author": {
"name": "George Mandis", "name": "George Mandis",

View file

@ -17,6 +17,11 @@ env.addFilter("formatDate", (dateString): string => {
return !Number.isNaN(date.getTime()) ? date.toLocaleDateString() : dateString; return !Number.isNaN(date.getTime()) ? date.toLocaleDateString() : dateString;
}); });
env.addFilter("formatTime", (dateString): string => {
const date: Date = new Date(Number.parseInt(dateString));
return !Number.isNaN(date.getTime()) ? date.toLocaleTimeString() : dateString;
});
env.addGlobal("now", new Date().toUTCString()); env.addGlobal("now", new Date().toUTCString());
// load the template // load the template