fix: catch Invalid Date (#17081)

This commit is contained in:
Stephen Zhou
2024-10-11 12:21:35 +08:00
committed by GitHub
parent 8f8bcb9365
commit a4daf28ca5
+10 -2
View File
@@ -74,8 +74,16 @@ const middleware: MiddlewareHandler = async (ctx, next) => {
}
if (outputType !== 'rss') {
item.pubDate && (item.pubDate = convertDateToISO8601(item.pubDate) || '');
item.updated && (item.updated = convertDateToISO8601(item.updated) || '');
try {
item.pubDate && (item.pubDate = convertDateToISO8601(item.pubDate) || '');
} catch {
item.pubDate = '';
}
try {
item.updated && (item.updated = convertDateToISO8601(item.updated) || '');
} catch {
item.updated = '';
}
}
}
}