Skip to content

Keep trying lastmod date formats until one of them parses - #606

Merged
ethangardner merged 2 commits into
GSA:mainfrom
arpitjain099:fix/sitemap-lastmod-day-first-date
Nov 6, 2026
Merged

ethangardner merged 2 commits into
GSA:mainfrom
arpitjain099:fix/sitemap-lastmod-day-first-date

Conversation

@arpitjain099

Copy link
Copy Markdown
Contributor

dateFormats lists MM/DD/YYYY and DD/MM/YYYY under an identical regex, so a day-first <lastmod> always matches the month-first entry first. parseFallbackDate returns that parser's output without checking it, and for 20/02/2025 the month-first parser builds 2025-20-02, an Invalid Date. Invalid Dates are truthy, so parseDate passes it along and getLastModDate calls toISOString() on it, throwing RangeError: Invalid time value.

runPage catches the throw, but parseBrowserError has no pattern for it, so the entire sitemap.xml page is stored as unknown_error and every sitemap column for that domain is cleared, not only the lastmod. I checked that classification by passing the RangeError through parseBrowserError directly.

The loop now continues until a format actually parses, which also makes the DD/MM/YYYY entry reachable for the first time. isDate ran the same loop with the same flaw, so it delegates now. The new spec drives createSitemapXmlScanner and throws on main.

AI assistance was used on this change and is disclosed in the commit trailer.

arpitjain099 and others added 2 commits October 19, 2026 23:39
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>

@ethangardner ethangardner left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. This looks good.

@ethangardner
ethangardner merged commit 40e94da into GSA:main Nov 6, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants