Skip to content

Commit

Permalink
Do not apply offset in EDD\Utils\Date. #6296
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyratilal committed Jun 28, 2018
1 parent 5afb51c commit ab7539d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
13 changes: 13 additions & 0 deletions includes/class-utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,19 @@ public function get_time_zone( $refresh = false ) {
* @since 3.0
*/
private function set_gmt_offset() {

// We need to calculate the GMT offset and these are a few ways this can be done.

// First, try and fetch a value from wp_options.
$offset = get_option( 'gmt_offset' );

// Get the timezone if gmt_offset does not exist in wp_options.
if ( empty( $offset ) ) {
$timezone = $this->get_time_zone( true );


}

$this->gmt_offset = get_option( 'gmt_offset', 0 ) * HOUR_IN_SECONDS;
}

Expand Down
5 changes: 0 additions & 5 deletions includes/utils/class-date.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ public function __construct( $time = 'now', \DateTimeZone $timezone = null ) {
}

parent::__construct( $time, $timezone );

// Apply the WP offset based on the WP timezone that was set.
$offset = $this->getOffset();
$interval = \DateInterval::createFromDateString( "{$offset} seconds" );
$this->add( $interval );
}

/**
Expand Down

0 comments on commit ab7539d

Please sign in to comment.