Ensure sitemap dates exist before sorting

This commit is contained in:
Sam Becker 2025-05-27 17:47:25 -05:00
parent 46e6ae2310
commit bdba4c8c7d

View File

@ -47,7 +47,7 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
...focalLengths.map(({ lastModified }) => lastModified),
...photos.map(({ updatedAt }) => updatedAt),
]
.filter(Boolean)
.filter(date => date instanceof Date)
.sort((a, b) => b.getTime() - a.getTime())[0];
return [