Closed jessequinn closed 3 years ago
Following the example found here When i work with the createdAt property of an article, regardless of rss, atom or json, i get the following error:
createdAt
item.date.toISOString is not a function
const articles = await $content('articles') .only(['title', 'description', 'slug', 'author', 'createdAt']) .sortBy('createdAt', 'desc') .fetch() articles.forEach((article) => { const url = `${baseUrlArticles}/${article.slug}` feed.addItem({ title: article.title, id: url, link: url, date: article.createdAt, // date: new Date(article.createdAt).toLocaleDateString('en', { // year: 'numeric', // month: 'long', // day: 'numeric', // }), description: article.description, content: article.description, author: article.author, }) })
Any ideas how to handle this?
Try date: new Date(article.createdAt)
date: new Date(article.createdAt)
thanks, appears to work with my custom date publishedAt.
Following the example found here When i work with the
createdAt
property of an article, regardless of rss, atom or json, i get the following error:Any ideas how to handle this?