fix: handle invalid dates
This commit is contained in:
parent
d8f40500bb
commit
0f146ea699
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user