fix: handle invalid dates

This commit is contained in:
max_richter 2025-01-25 18:36:41 +01:00
parent d8f40500bb
commit 0f146ea699

View File

@ -23,7 +23,11 @@ function generateJsonLd(resource: GenericResource): string {
}
if (resource.meta?.date) {
baseSchema.datePublished = new Date(resource.meta.date).toISOString();
try {
baseSchema.datePublished = new Date(resource.meta.date).toISOString();
} catch (_) {
// Ignore invalid date
}
}
if (resource.meta?.rating) {