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

WordPress Trac noreply at wordpress.org
Mon Jan 16 23:38:27 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.2
Component:  REST API                    |     Version:  4.7
 Severity:  major                       |  Resolution:
 Keywords:  needs-patch has-unit-tests  |     Focuses:
----------------------------------------+--------------------

Comment (by jnylen0):

 In [attachment:39256.2.diff]:

 1. Fix the '''first''' issue described in the original report.  The
 problem was that a value for the `date` field without a timezone offset
 was being interpreted as a UTC date during parsing.

 2. Improve behavior when specifying dates with timezone offsets (do not
 remove the timezone offset to force a date into UTC).  Previously, you
 could set `date_gmt` to e.g. `2016-12-12T18:00:00-01:00`... and this would
 be interpreted as `2016-12-12T18:00:00` UTC.  I can't think of a reason
 why this is what you would want.

 3. Tests for all of the above cases (and some extra ones for the
 `rest_parse_date` function).  Currently there are basically no tests for
 REST API date handling.

 Still left to do:

 - Allow updating the date of a draft.  I'll address that in this ticket.
 - Figure out a way to work around the zero/null `date_gmt` terribleness
 with drafts.  I have some further ideas on this, but this work can happen
 on #38883 after this ticket is done.

 This latest patch has 28 test cases for updating post dates using the API
 (6 failing; 22 passing).

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


More information about the wp-trac mailing list