Yoast SEO retrieves the date information directly from the WordPress database. The sitemaps will have empty or invalid dates when the date information is invalid or incomplete in the database.
Please search the database for invalid or empty date entries and correct the dates – Date (post_date), Date GMT (post_date_gmt), Modified (post_modified), and Modified GMT (post_modified_gmt) fields in the database. You might see something like 0000-00-00 00:00:00 in one or more fields. Fixing the issue requires a manual calculation to/from the GMT date to the WordPress-selected time zone.
Once the database has the correct dates in all date fields, please try the following:
- Install & activate the Yoast Test Helper plugin
- Go to Tools > Yoast Test
- Locate the Yoast SEO section and click on the ‘Reset indexables tables & migrations‘, ‘Reset Prominent words calculation‘, and ‘Reset Internal link counter‘ buttons. After each click, the page will reload to confirm that the specific reset was successful.
- Go to SEO > Tools, and under SEO data, click the “Start SEO data optimization” button to allow Yoast to rescan your content.
Please let us know if the reported issue remains after resetting the optimized data.
Note: Resetting the optimization doesn’t undo any of the hard work you’ve put into the plugin as the SEO data is also stored in WordPress’ default tables. It’ll just reset the custom Yoast tables that contain the combined data pulled from those default tables.