From 75960b743bc73b2216007bb76653876d11ba861d Mon Sep 17 00:00:00 2001 From: Harlan Wilton Date: Fri, 29 Dec 2023 00:39:07 +1100 Subject: [PATCH] chore: lint --- src/runtime/sitemap/urlset/normalise.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/runtime/sitemap/urlset/normalise.ts b/src/runtime/sitemap/urlset/normalise.ts index 58a11ba..3547a65 100644 --- a/src/runtime/sitemap/urlset/normalise.ts +++ b/src/runtime/sitemap/urlset/normalise.ts @@ -104,13 +104,11 @@ export function normaliseDate(d: Date | string) { if (typeof d === 'string') { // we may have milliseconds at the end with a dot prefix like ".963745", we should remove this d = d.replace(/\.\d+$/, '') - console.log('match', d, d.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/)) // we may have a value like this "2023-12-21T13:49:27", this needs to be converted to w3c datetime // accept if they are already in the right format, accept small format too such as "2023-12-21" - if (d.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/) || d.match(/^\d{4}-\d{2}-\d{2}$/)) { - console.log('pass') + if (d.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/) || d.match(/^\d{4}-\d{2}-\d{2}$/)) return d - } + // otherwise we need to parse it d = new Date(d) // check for invalid date