fix: convert Date objects to ISO strings for blog edit items

The Indiekit date filter calls parseISO() which expects a string.
MongoDB returns Date objects for item.published, causing
"dateString.split is not a function" error on the blog edit page.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ricardo
2026-02-09 11:02:36 +01:00
parent e0d4de2fea
commit d7f2344c4b
2 changed files with 9 additions and 2 deletions

View File

@@ -157,7 +157,14 @@ async function edit(request, response) {
return response.status(404).render("404");
}
const items = await getItemsForBlog(application, blog._id, 10);
const rawItems = await getItemsForBlog(application, blog._id, 10);
const items = rawItems.map((item) => ({
...item,
published:
item.published instanceof Date
? item.published.toISOString()
: item.published,
}));
response.render("blogroll-blog-edit", {
title: request.__("blogroll.blogs.edit"),

View File

@@ -1,6 +1,6 @@
{
"name": "@rmdes/indiekit-endpoint-blogroll",
"version": "1.0.8",
"version": "1.0.9",
"description": "Blogroll endpoint for Indiekit. Aggregates blog feeds from OPML, JSON feeds, or manual entry.",
"keywords": [
"indiekit",