WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#38986 closed defect (bug) (duplicate)

WP-API - List posts: `before` and `after` doesn't seem to support true ISO 8601

Reported by: LaustDeleuran Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6.1
Component: REST API Keywords:
Focuses: Cc:

Description

Originally posted on WP-API's GitHub - https://github.com/WP-API/WP-API/issues/2933. Reposting here as [requested by Edwin Cromley](https://github.com/BE-Webdesign).


Opening this endpoint:

http://demo.wp-api.org/wp-json/wp/v2/posts?before=2016-11-29

Tells me that The date you provided is invalid.. However, I _am_ providing a [ISO 8601 compliant](https://en.wikipedia.org/wiki/ISO_8601) date, as [according to](https://cl.ly/3p2G3D3f2e1T) the [documentation](http://v2.wp-api.org/reference/posts/).

It looks like providing a full date (with time), makes the endpoint work as expected:

http://demo.wp-api.org/wp-json/wp/v2/posts?before=2016-11-29T00:00:00Z

Maybe the documentation needs to be updated to reflect that?

Change History (5)

This ticket was mentioned in Slack in #core-restapi by chopinbach. View the logs.


4 years ago

#2 @LaustDeleuran
4 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #38641.

Looks like this is a duplicate of https://core.trac.wordpress.org/ticket/38641

#3 in reply to: ↑ description @jnylen0
4 years ago

Hi @LaustDeleuran - I agree that #38641 is the right place to track this, but one angle that is not covered there is that our documentation implies full ISO8601 compliance.

Would you mind leaving a comment over there to that effect? This will help us prioritize this issue as it's currently labeled as an enhancement without any mention of the incorrect docs.

#4 @netweb
3 years ago

  • Milestone Awaiting Review deleted

#5 @LaustDeleuran
3 years ago

@jnylen0 didnt get any notifications about this issue, so forgot about it, but just ran into it again on another project. Reposting the details from this on #38641 as you suggested.

Note: See TracTickets for help on using tickets.