Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sitemap.xml uses invalid datetime separator #15172

Closed
JMalaprade opened this issue Jan 26, 2024 · 3 comments · Fixed by #15229
Closed

Sitemap.xml uses invalid datetime separator #15172

JMalaprade opened this issue Jan 26, 2024 · 3 comments · Fixed by #15229
Labels
Milestone

Comments

@JMalaprade
Copy link

Noticed that sitemap.xml returns "invalid date" errors in a Google Console's sitemap verification tool. I believe this happens because the sitemap uses a wrong datetime separator: dots instead of colons.

Example of the current situation:
<url> <loc> https://www.domain.fi/somehting </loc> <lastmod>2023-11-27T06.07.36+00:00</lastmod> <changefreq>daily</changefreq> <priority>0.5</priority> </url>

That should be (YYYY-MM-DDThh:mm:ss.sTZD):
<url> <loc> https://www.domain.fi/somehting </loc> <lastmod>2023-11-27T06:07:36+00:00</lastmod> <changefreq>daily</changefreq> <priority>0.5</priority> </url>

@MikeAlhayek
Copy link
Member

@JMalaprade what version are you using?

Looking at the code briefly, seems that we are using the correct format

lastMod.Add(contentItem.ModifiedUtc.GetValueOrDefault().ToString("yyyy-MM-ddTHH:mm:sszzz"));

and

lastMod.Add(source.LastUpdate.GetValueOrDefault().ToString("yyyy-MM-ddTHH:mm:sszzz", CultureInfo.InvariantCulture));

@sebastienros
Copy link
Member

@MikeAlhayek the first sample you point to is missing CultureInfo.InvariantCulture. Without it it will use the local culture, which is the issue that is described.

@sebastienros sebastienros added this to the 1.x milestone Feb 1, 2024
@MikeAlhayek
Copy link
Member

uh! I missed that. good catch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants