WordPress.org

Make WordPress Core

Changeset 42109


Ignore:
Timestamp:
11/02/2017 07:59:55 PM (8 months ago)
Author:
westonruter
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r42107 r42109  
    45844584        }
    45854585
    4586         if ( $this->changeset_post_id() && 'future' === get_post_status( $this->changeset_post_id() ) ) {
    4587             $initial_date = get_the_time( 'Y-m-d H:i:s', $this->changeset_post_id() );
    4588         } else {
    4589             $initial_date = current_time( 'mysql', false );
     4586        // Determine initial date to be at present or future, not past.
     4587        $current_time = current_time( 'mysql', false );
     4588        $initial_date = $current_time;
     4589        if ( $changeset_post ) {
     4590            $initial_date = get_the_time( 'Y-m-d H:i:s', $changeset_post->ID );
     4591            if ( $initial_date < $current_time ) {
     4592                $initial_date = $current_time;
     4593            }
    45904594        }
    45914595
     
    46084612                'lockUser' => $lock_user_id ? $this->get_lock_user_data( $lock_user_id ) : null,
    46094613            ),
    4610             'initialServerDate' => current_time( 'mysql', false ),
     4614            'initialServerDate' => $current_time,
    46114615            'dateFormat' => get_option( 'date_format' ),
    46124616            'timeFormat' => get_option( 'time_format' ),
Note: See TracChangeset for help on using the changeset viewer.