Fix product reviews schema date fields to use new (WP 5.5) date-time
format
#3109
Conversation
Size Change: 0 B Total Size: 1.11 MB ℹ️ View Unchanged
|
I notice that the dates are both the same - one maybe should have a timezone offset. Not sure if this is a bug, or if so what impact it would have… |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only tested with WordPress 5.5 - should we test with 5.3 or 5.4 as well?
I tested with 5.4 and everything looked fine. 👌
I notice that the dates are both the same - one maybe should have a timezone offset. Not sure if this is a bug, or if so what impact it would have…
That should depend on the store timezone (in Settings > General > Timezone) that was selected when the review was written. Maybe you had UTC+0
?
Yep that was it 👍 |
Fixes #3005
This PR fixes the schema for product reviews API endpoint.
In WordPress 5.5, the
type
must be one of the primitive types; previously we haddate-time
.Schemas can declare the intended format of
type: string
, and for our dates we should usedate-time
aka RFC3339.So, this PR uses
type: string, format: date-time
for the two review date fields.I did a quick search to see if there were other API dates that should use this format - looks like this is the only API affected.
To test this I added some reviews and an
All Reviews
block and checked the response.Screenshots
How to test the changes in this Pull Request:
I only tested with WordPress 5.5 - should we test with 5.3 or 5.4 as well?
Also keen to confirm this fixes the
doing it wrong
error - is there a way to reproduce that (onmain
/without these changes)? Or is this only validated when POSTing?Changelog