WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/07/2019 09:11:37 AM (20 months ago)
Author:
SergeyBiryukov
Message:

Date/Time: Reduce explicit local current_time( 'timestamp' ) usage in favor of native PHP functions.

Timestamps don't carry any timezone information, using the intended format directly simplifies the logic and makes the code less confusing.

Props Rarst, jdgrimes.
See #40657.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/general-template.php

    r44725 r44809  
    20062006    // week_begins = 0 stands for Sunday
    20072007    $week_begins = (int) get_option( 'start_of_week' );
    2008     $ts          = current_time( 'timestamp' );
    20092008
    20102009    // Let's figure out when we are
     
    20262025        }
    20272026    } else {
    2028         $thisyear  = gmdate( 'Y', $ts );
    2029         $thismonth = gmdate( 'm', $ts );
     2027        $thisyear  = current_time( 'Y' );
     2028        $thismonth = current_time( 'm' );
    20302029    }
    20312030
     
    21372136        $newrow = false;
    21382137
    2139         if ( $day == gmdate( 'j', $ts ) &&
    2140             $thismonth == gmdate( 'm', $ts ) &&
    2141             $thisyear == gmdate( 'Y', $ts ) ) {
     2138        if ( $day == current_time( 'j' ) &&
     2139            $thismonth == current_time( 'm' ) &&
     2140            $thisyear == current_time( 'Y' ) ) {
    21422141            $calendar_output .= '<td id="today">';
    21432142        } else {
Note: See TracChangeset for help on using the changeset viewer.