Make WordPress Core

Opened 13 months ago

#41032 new defect (bug)

REST API: Date fields do not support ISO8601

Reported by: jnylen0 Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: REST API Keywords:
Focuses: docs, rest-api Cc:


The post and comment date and date_gmt fields as well as a couple of others like the post before and after fields claim to support ISO8601 but this is not entirely accurate.

The actual format supported is that handled by the `rest_parse_date` function: YYYY-MM-DDTHH:MM:SS plus optional fractional seconds plus an optional timezone specifier in the form Z, +XX, -XX, +XX:XX, or -XX:XX.

Additionally, WordPress behavior around timezones is complicated and poorly specified. The post_date database field is stored in the site's current timezone, and how to interact with this using before and after in particular is not clear. (The best way to do it is probably to avoid specifying a timezone string at all for these values, unless the site's timezone is known by the API client and specified exactly.)

All of this needs to be documented at https://developer.wordpress.org/rest-api/ and any missing test cases added.

Change History (0)

Note: See TracTickets for help on using tickets.