#60184 closed defect (bug) (fixed)
Publication date 01/01/1970 is refused
Reported by: | emmanuel78 | Owned by: | kadamwhite |
---|---|---|---|
Milestone: | 6.7 | Priority: | normal |
Severity: | normal | Version: | 6.4.2 |
Component: | REST API | Keywords: | has-patch has-unit-tests commit |
Focuses: | rest-api | Cc: |
Description
I want to publish an artical refering to a real book.
Then the publication date is set with to book one and not the article publication date.
Defect => the jan-01-1970 is refused by WordPress.
Instead of, I set jan-02-1970
Attachments (1)
Change History (11)
#1
@
3 months ago
- Component changed from General to Editor
- Focuses rest-api added
Hi and welcome to WordPress Core Trac!
I received a REST API error message when I tried to save a post in the (block) editor with a publish date of 01/01/1970 at midnight local time. If it compares against the Unix epoch time with a less than or greater than operator, that may need to account for equality too (<=
).
For workarounds:
- I was able to set the publish date to 12:01am in the editor.
- Quick Edit allows setting the time to 00:00.
This ticket was mentioned in PR #7277 on WordPress/wordpress-develop by @siliconforks.
3 months ago
#2
- Keywords has-patch has-unit-tests added
This fixes handling of dates representing the Unix epoch (1970-01-01T00:00:00Z).
Trac ticket: https://core.trac.wordpress.org/ticket/60184
#3
@
3 months ago
- Keywords needs-testing added
Here is an easy way to reproduce this issue using only the command line:
curl \ -X POST WORDPRESS_URL/wp-json/wp/v2/posts \ -u 'USERNAME:APPLICATION_PASSWORD' \ -H 'Content-Type: application/json; charset=UTF-8' \ -d '{"title":"Post created via REST API","date_gmt":"1970-01-01T00:00:00Z"}'
Change:
- WORDPRESS_URL to the URL of your WordPress installation
- USERNAME to your WordPress admin username (or at least some user with the capability of creating posts)
- APPLICATION_PASSWORD to an application password for that user
#4
@
3 months ago
- Component changed from Editor to REST API
As the bug is in the REST API's code, I've updated to component to ensure the issue is seen by the correct component maintainers.
This ticket was mentioned in Slack in #core-restapi by kadamwhite. View the logs.
3 months ago
#7
@
3 months ago
- Keywords needs-testing removed
Test Report
Environment
- Server: Apache (Linux)
- WordPress: 6.7-alpha-58576-src
- Browser: Chrome 128.0.6613.138
- OS: Mac
- Theme: Twenty Twenty-Four
- Plugins: None activated
Steps to Reproduce
- Create a new post
- Set the publish date to be January 1st, 1970 at 12:00 a.m.
- Attempt to publish the post.
- A red banner will appear stating that "Updating failed. Invalid parameter(s): date"
- Confirmed seeing the issue when the error was reported.
Results
- Issue reproduced. ✅
- Confirmed post create at January 1st, 1970 at 12:00 a.m. was successful.
Applied PR from GitHub.
#8
@
3 months ago
- Keywords commit added
- Owner set to kadamwhite
- Status changed from new to assigned
Reviewed this patch during contributor day for commit, marking commit! Hi @kadamwhite !
@kadamwhite commented on PR #7277:
3 months ago
#10
Thanks for your contribution! This has been committed in changeset r59040, Git hash 71c69dad2e05fd51c508b1311805083943dc5398
trying to publish at midnight (U.S. Central) January 1, 1970