Changeset 45876 for trunk/src/wp-includes/class-wp-date-query.php
- Timestamp:
- 08/22/2019 03:10:05 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-date-query.php
r45850 r45876 854 854 * You can pass an array of values (year, month, etc.) with missing parameter values being defaulted to 855 855 * either the maximum or minimum values (controlled by the $default_to parameter). Alternatively you can 856 * pass a string that will be run through strtotime().856 * pass a string that will be passed to date_create(). 857 857 * 858 858 * @since 3.7.0 … … 866 866 */ 867 867 public function build_mysql_datetime( $datetime, $default_to_max = false ) { 868 $now = current_time( 'timestamp' );869 870 868 if ( ! is_array( $datetime ) ) { 871 869 … … 908 906 // If no match is found, we don't support default_to_max. 909 907 if ( ! is_array( $datetime ) ) { 910 // @todo Timezone issues here possibly 911 return gmdate( 'Y-m-d H:i:s', strtotime( $datetime, $now ) ); 908 $wp_timezone = wp_timezone(); 909 910 // Assume local timezone if not provided. 911 $dt = date_create( $datetime, $wp_timezone ); 912 913 if ( false === $dt ) { 914 return gmdate( 'Y-m-d H:i:s', false ); 915 } 916 917 return $dt->setTimezone( $wp_timezone )->format( 'Y-m-d H:i:s' ); 912 918 } 913 919 } … … 916 922 917 923 if ( ! isset( $datetime['year'] ) ) { 918 $datetime['year'] = gmdate( 'Y', $now);924 $datetime['year'] = current_time( 'Y' ); 919 925 } 920 926
Note: See TracChangeset
for help on using the changeset viewer.