From 8902ddba18930f8a6c4a6eec12d4d2742e7eb9ce Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Thu, 2 Nov 2017 20:00:48 +0000 Subject: [PATCH] Customize: Always use underlying changeset post date as initial date in scheduled date fields if date is future. Prevent user from having to re-enter the previously-supplied future date if they had switched from schedule to draft but wanted to switch back again. Improves parity with behavior of post edit screen. Props dlh, westonruter, obenland. See #39896, #28721. Fixes #42413. Built from https://develop.svn.wordpress.org/trunk@42109 git-svn-id: http://core.svn.wordpress.org/trunk@41938 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-customize-manager.php | 14 +++++++++----- wp-includes/version.php | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index 4e66070292..607349b04a 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -4583,10 +4583,14 @@ final class WP_Customize_Manager { $changeset_post = get_post( $changeset_post_id ); } - if ( $this->changeset_post_id() && 'future' === get_post_status( $this->changeset_post_id() ) ) { - $initial_date = get_the_time( 'Y-m-d H:i:s', $this->changeset_post_id() ); - } else { - $initial_date = current_time( 'mysql', false ); + // Determine initial date to be at present or future, not past. + $current_time = current_time( 'mysql', false ); + $initial_date = $current_time; + if ( $changeset_post ) { + $initial_date = get_the_time( 'Y-m-d H:i:s', $changeset_post->ID ); + if ( $initial_date < $current_time ) { + $initial_date = $current_time; + } } $lock_user_id = false; @@ -4607,7 +4611,7 @@ final class WP_Customize_Manager { 'statusChoices' => $status_choices, 'lockUser' => $lock_user_id ? $this->get_lock_user_data( $lock_user_id ) : null, ), - 'initialServerDate' => current_time( 'mysql', false ), + 'initialServerDate' => $current_time, 'dateFormat' => get_option( 'date_format' ), 'timeFormat' => get_option( 'time_format' ), 'initialServerTimestamp' => floor( microtime( true ) * 1000 ), diff --git a/wp-includes/version.php b/wp-includes/version.php index 203c7e90cc..8d76a61c04 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9-RC1-42108'; +$wp_version = '4.9-RC1-42109'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.