[wp-trac] [WordPress Trac] #39256: REST API: Multiple issues with setting dates of posts

WordPress Trac noreply at wordpress.org
Sat Feb 18 01:31:56 UTC 2017


#39256: REST API: Multiple issues with setting dates of posts
----------------------------------------+--------------------
 Reporter:  jnylen0                     |       Owner:
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  4.7.3
Component:  REST API                    |     Version:  4.7
 Severity:  major                       |  Resolution:
 Keywords:  needs-patch has-unit-tests  |     Focuses:
----------------------------------------+--------------------

Comment (by jnylen0):

 Replying to [comment:5 aduth]:
 > The `$has_timezone` regular expression could incorrectly match e.g.
 `+99:99` ...
 I am not super worried about this.
 > ... and does not match a valid `-0500` (omitting `:` permitted). More
 accurate option might be `#(Z|[+-]([0-1]\d|2[0-4])(:?[0-5]\d)?)$#`
 The regex is based on the
 [https://core.trac.wordpress.org/browser/tags/4.7.2/src/wp-includes/rest-
 api.php#L769 existing regex] in `rest_parse_date`.  I'd prefer to preserve
 the existing behavior for now, and address this in a separate ticket.

 Note that REST API date parsing is more strict than ISO8601 in other ways
 as well:  we require dashes in between year, month, and day, and colons in
 between hour, minute, and second, whereas the standard does not.

 > `rest_get_date_with_gmt` had previously been the only function to call
 `rest_parse_date` with a second parameter. Since it no longer does, should
 we remove that argument altogether?

 I was hoping to get more feedback on this specific point by now, but we
 may need to deprecate `rest_parse_date` and replace it with a new
 function.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39256#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list