[wp-trac] [WordPress Trac] #38883: Shim post_date_gmt for drafts / empty dates in the REST API
WordPress Trac
noreply at wordpress.org
Thu Feb 23 19:52:38 UTC 2017
#38883: Shim post_date_gmt for drafts / empty dates in the REST API
---------------------------------------------+-----------------------
Reporter: joehoyle | Owner: jnylen0
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 4.7.3
Component: REST API | Version: 4.7
Severity: normal | Resolution:
Keywords: has-unit-tests has-patch commit | Focuses:
---------------------------------------------+-----------------------
Changes (by jnylen0):
* keywords: has-unit-tests has-patch => has-unit-tests has-patch commit
* owner: rmccue => jnylen0
* status: reviewing => accepted
Comment:
Replying to [comment:13 jnylen0]:
> If a GMT date is updated for a draft, we can either assume or verify
that the corresponding `post_*_gmt` field is all zeroes, then make the
requested change to the non-GMT field instead (backing out the site's
timezone offset).
I've since changed my mind about this. For 4.7.3 we should preserve the
existing behavior: updating either `date` or `date_gmt` represents the
client's explicit intent to set the date rather than have WP update it
based on a zero `post_date_gmt` field.
If the behavior to determine whether a draft has a zero `post_date_gmt` is
missed, we can add a new field for this later on (#39953).
> If both `date` and `date_gmt` are specified in an update, and it's a
draft, and this would lead to different values for the date... I guess
that should probably be an error.
This should be a separate ticket as well (#39954).
Other changes in [attachment:38883.2.diff]:
- Fix the sign of the timezone offset
- Add better, more direct tests including a non-zero timezone offset
- Clean up comments and tests (remove some duplicate test logic)
So I think this is pretty much ready to go. If anyone has any feedback
please leave it ASAP because this needs to land in 4.7.3.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38883#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list