Automattic / msm-sitemap

Comprehensive sitemaps for your WordPress VIP site. Joint collaboration between Metro.co.uk, WordPress VIP, Alley Interactive, Maker Media, 10up, and others.
73 stars 37 forks source link

Sitemap generation not considering local time #157

Open juankk opened 4 years ago

juankk commented 4 years ago

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

t-wright commented 4 years ago

Related ticket: #105741-zd-wordpressvip

t-wright commented 4 years ago

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.