[wp-trac] [WordPress Trac] #41032: REST API: Date fields do not support ISO8601
WordPress Trac
noreply at wordpress.org
Tue Jun 13 17:46:16 UTC 2017
#41032: REST API: Date fields do not support ISO8601
----------------------------+----------------------------
Reporter: jnylen0 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: REST API | Version:
Severity: normal | Keywords:
Focuses: docs, rest-api |
----------------------------+----------------------------
The post and comment `date` and `date_gmt` fields as well as a couple of
others like the post `before` and `after` fields
[https://core.trac.wordpress.org/browser/tags/4.8/src/wp-includes/rest-
api.php#L776 claim to support ISO8601] but this is not entirely accurate.
The actual format supported is that handled by the
[https://core.trac.wordpress.org/browser/tags/4.8/src/wp-includes/rest-
api.php#L776 `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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41032>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list