Skip to content

Commit

Permalink
Merge branch 'bugfix/fix-timezone'
Browse files Browse the repository at this point in the history
  • Loading branch information
sectsect committed Oct 19, 2024
2 parents acee44f + bf9833d commit 566866e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions includes/save.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ function get_value_google_spreadsheet( string $worksheet_id, string $worksheet_n
function save_spreadsheet(): array {
global $wpdb;
$today = new DateTime();
$timezone_string = get_option( 'timezone_string' );
if ( ! is_string( $timezone_string ) || empty( $timezone_string ) ) {
return array(); // Early return if not a valid string.
$timezone_string = wp_timezone_string();
if ( empty( $timezone_string ) ) {
wp_die( __( 'Error: Timezone is not set. Please check your WordPress settings.', 'google_ss2db' ) );
}
$today->setTimeZone( new DateTimeZone( $timezone_string ) );
$date = $today->format( 'Y-m-d H:i:s' );
Expand Down

0 comments on commit 566866e

Please sign in to comment.