msm-sitemap icon indicating copy to clipboard operation
msm-sitemap copied to clipboard

Sitemap generation not considering local time

Open juankk opened this issue 5 years ago • 2 comments

Having the site hosted in Sydney +11 hours we are seeing today's sitemap file does not appear in the list of sitemaps unitl 11am Sydney time each day.

The current time in Sydney is 10am and it is still showing yesterday's file (26th February).

investigating the plugins seems that the search on the cronjob is considering utc times.

PR: https://github.com/Automattic/msm-sitemap/pull/158

juankk avatar Mar 10 '20 03:03 juankk

Related ticket: #105741-zd-wordpressvip

t-wright avatar Mar 11 '20 03:03 t-wright

Adding some extra documentation to this issue:

Issue Daily sitemaps are created at midnight UTC but posts appear in the daily sitemap which corresponds to their local publish date. For sites in a UTC+ timezone, this causes posts created after midnight local time to be missing from the sitemap until midnight UTC.

What should happen Posts should probably appear in the daily site map according to their UTC publish date.

Why does this issue occur The $start_date and $end_date passed to the queries which get the sitemap's posts date_range_has_posts() and get_post_ids_for_date() are in server (UTC) time, while the post_date being queried is in local time according to the timezone setting in wp-admin.

What sites does this impact This issue impacts sites in a UTC+ timezone.

t-wright avatar Mar 17 '20 00:03 t-wright