Skip to content

Commit

Permalink
Merge pull request #45 from takayukister/dev/5.1
Browse files Browse the repository at this point in the history
Output correct date options based on WP timezone setting
  • Loading branch information
takayukister authored May 20, 2020
2 parents 4dcf18c + c07c96b commit 2e662af
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions includes/form-tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,14 @@ public function get_date_option( $opt ) {
$unit = 'days';
}

$date = gmdate( 'Y-m-d',
strtotime( sprintf( 'today %1$s %2$s', $number, $unit ) ) );
return $date;
// Temporary fix until introducing wp_date()
$today = gmdate( 'Y-m-d',
time() + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS
);

$format = sprintf( '%1$s %2$s %3$s', $today, $number, $unit );

return gmdate( 'Y-m-d', strtotime( $format ) );
}

return false;
Expand Down

0 comments on commit 2e662af

Please sign in to comment.