wp post generate creates scheduled posts when the site timezone is ahead of UTC
Bug Report
- [x] Yes, I reviewed the contribution guidelines.
- [x] Yes, more specifically, I reviewed the guidelines on how to write clear bug reports.
Describe the current, buggy behavior
When generating posts on a site where the Timezone setting is ahead of UTC, the timestamp appears correct but each post is scheduled by default, rather than published.
Describe how other contributors can replicate this bug
- Set the site's timezone to something ahead of UTC, for example
wp option update timezone_string "Europe/London"(or you can do this from the General Settings screen). - Run
wp post generate - Visit the Posts screen in the admin area and note that all the generated posts are scheduled, despite having the correct post date.
The problem does not occur if the timezone is changed to UTC+0, or changed to a timezone behind UTC, for example America/New_York.
Describe what you would expect as the correct outcome
I would expect the posts to be published.
Let us know what environment you are running this on
OS: Darwin 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64
Shell: /bin/zsh
PHP binary: /usr/local/Cellar/php/7.3.9_1/bin/php
PHP version: 7.3.9
php.ini used: /usr/local/etc/php/7.3/php.ini
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: /Users/john
WP-CLI packages dir: /Users/john/.wp-cli/packages/
WP-CLI global config: /Users/john/.wp-cli/config.yml
WP-CLI project config:
WP-CLI version: 2.3.0
I've tested this with WordPress 5.2.3 and with the latest trunk, and both exhibit the same result, but notably trunk marks the post as having missed its schedule.
Looks like the problem still manifests in 6.2.2:
working on this one